diff options
author | Mathias Hall-Andersen <mathias@hall-andersen.dk> | 2018-02-11 23:26:54 +0100 |
---|---|---|
committer | Mathias Hall-Andersen <mathias@hall-andersen.dk> | 2018-02-11 23:26:54 +0100 |
commit | 6cba91999c8b43dc979e707f7bbbaabf786f68bd (patch) | |
tree | c79cff69af5c64859b51cc83f9f05196b922e449 /tun.go | |
parent | 04ded4c63183927feba565a43fafc987dba32005 (diff) |
TUN status hack was causing spam during shutdown
Diffstat (limited to 'tun.go')
-rw-r--r-- | tun.go | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -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() } } |