summaryrefslogtreecommitdiff
path: root/src/device.go
diff options
context:
space:
mode:
authorMathias Hall-Andersen <mathias@hall-andersen.dk>2017-08-17 12:58:18 +0200
committerMathias Hall-Andersen <mathias@hall-andersen.dk>2017-08-17 12:58:18 +0200
commit04640eb629f9c6a7bd4561f2a2f5b07195aa6009 (patch)
treec2d348c455aa4b50d77202ae268c7fe001bd274b /src/device.go
parent24f9394f6426aff16d94a76cc3994dba1a8705b1 (diff)
downloadwireguard-go-04640eb629f9c6a7bd4561f2a2f5b07195aa6009.tar.gz
wireguard-go-04640eb629f9c6a7bd4561f2a2f5b07195aa6009.zip
Added missing IF index check
Diffstat (limited to 'src/device.go')
-rw-r--r--src/device.go16
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")
+ }
}
}
}