Added missing IF index check

This commit is contained in:
Mathias Hall-Andersen
2017-08-17 12:58:18 +02:00
parent 24f9394f64
commit 04640eb629
3 changed files with 37 additions and 22 deletions

View File

@@ -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")
}
}
}
}