From 9360bac63290d7869c07c0d1ba40f3f34fd39b83 Mon Sep 17 00:00:00 2001 From: Mathias Hall-Andersen Date: Thu, 4 Jan 2018 14:24:14 +0100 Subject: Revert "Peer timer teardown" This reverts commit d73f960aab86b9a12b0b7d18aa80ce1d4f130695. Problems with deadlocking arises due to orphaned packets in per-peer queues. Additional work on this issue continues in seperate branch. --- src/tun.go | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src/tun.go') diff --git a/src/tun.go b/src/tun.go index 024f0f0..54253b4 100644 --- a/src/tun.go +++ b/src/tun.go @@ -46,13 +46,21 @@ func (device *Device) RoutineTUNEventReader() { } if event&TUNEventUp != 0 { - logInfo.Println("Interface set up") - device.Up() + if !device.tun.isUp.Get() { + // begin listening for incomming datagrams + logInfo.Println("Interface set up") + device.tun.isUp.Set(true) + updateBind(device) + } } if event&TUNEventDown != 0 { - logInfo.Println("Interface set down") - device.Up() + if device.tun.isUp.Get() { + // stop listening for incomming datagrams + logInfo.Println("Interface set down") + device.tun.isUp.Set(false) + closeBind(device) + } } } } -- cgit v1.2.3