Added missing IF index check
This commit is contained in:
parent
24f9394f64
commit
04640eb629
3 changed files with 37 additions and 22 deletions
|
|
@ -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")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue