diff options
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") + } } } } |