From 6cba91999c8b43dc979e707f7bbbaabf786f68bd Mon Sep 17 00:00:00 2001 From: Mathias Hall-Andersen Date: Sun, 11 Feb 2018 23:26:54 +0100 Subject: TUN status hack was causing spam during shutdown --- tun.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'tun.go') diff --git a/tun.go b/tun.go index 6259f33..7b044ad 100644 --- a/tun.go +++ b/tun.go @@ -26,6 +26,7 @@ type TUNDevice interface { } func (device *Device) RoutineTUNEventReader() { + setUp := false logInfo := device.log.Info logError := device.log.Error @@ -45,13 +46,15 @@ func (device *Device) RoutineTUNEventReader() { } } - if event&TUNEventUp != 0 && !device.isUp.Get() { + if event&TUNEventUp != 0 && !setUp { logInfo.Println("Interface set up") + setUp = true device.Up() } - if event&TUNEventDown != 0 && device.isUp.Get() { + if event&TUNEventDown != 0 && setUp { logInfo.Println("Interface set down") + setUp = false device.Down() } } -- cgit v1.2.3-59-g8ed1b