diff options
author | Mathias Hall-Andersen <mathias@hall-andersen.dk> | 2017-08-17 12:58:18 +0200 |
---|---|---|
committer | Mathias Hall-Andersen <mathias@hall-andersen.dk> | 2017-08-17 12:58:18 +0200 |
commit | 04640eb629f9c6a7bd4561f2a2f5b07195aa6009 (patch) | |
tree | c2d348c455aa4b50d77202ae268c7fe001bd274b /src/device.go | |
parent | 24f9394f6426aff16d94a76cc3994dba1a8705b1 (diff) |
Added missing IF index check
Diffstat (limited to 'src/device.go')
-rw-r--r-- | src/device.go | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/device.go b/src/device.go index dfd2f35..9bcd2f5 100644 --- a/src/device.go +++ b/src/device.go @@ -196,15 +196,19 @@ func (device *Device) RoutineTUNEventReader() { } if event&TUNEventUp != 0 { - device.tun.isUp.Set(true) - updateUDPConn(device) - logInfo.Println("Interface set up") + if !device.tun.isUp.Get() { + device.tun.isUp.Set(true) + updateUDPConn(device) + logInfo.Println("Interface set up") + } } if event&TUNEventDown != 0 { - device.tun.isUp.Set(false) - closeUDPConn(device) - logInfo.Println("Interface set down") + if device.tun.isUp.Get() { + device.tun.isUp.Set(false) + closeUDPConn(device) + logInfo.Println("Interface set down") + } } } } |