aboutsummaryrefslogtreecommitdiffstats
path: root/device
diff options
context:
space:
mode:
authorJosh Bleecher Snyder <josh@tailscale.com>2021-02-08 10:19:28 -0800
committerJosh Bleecher Snyder <josh@tailscale.com>2021-02-08 10:32:07 -0800
commit3516ccc1e226756c4ba6d431cbf7e3a3fe63c5f8 (patch)
treefd9c3fbda6f16129969ae6091496ab3cb1102f01 /device
parentdevice: overhaul device state management (diff)
downloadwireguard-go-3516ccc1e226756c4ba6d431cbf7e3a3fe63c5f8.tar.xz
wireguard-go-3516ccc1e226756c4ba6d431cbf7e3a3fe63c5f8.zip
device: remove device.state.stopping from RoutineTUNEventReader
The TUN event reader does three things: Change MTU, device up, and device down. Changing the MTU after the device is closed does no harm. Device up and device down don't make sense after the device is closed, but we can check that condition before proceeding with changeState. There's thus no reason to block device.Close on RoutineTUNEventReader exiting. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
Diffstat (limited to 'device')
-rw-r--r--device/device.go2
-rw-r--r--device/tun.go1
2 files changed, 1 insertions, 2 deletions
diff --git a/device/device.go b/device/device.go
index c637e38..52b0143 100644
--- a/device/device.go
+++ b/device/device.go
@@ -383,7 +383,7 @@ func NewDevice(tunDevice tun.Device, logger *Logger) *Device {
go device.RoutineHandshake()
}
- device.state.stopping.Add(2)
+ device.state.stopping.Add(1) // read from TUN
go device.RoutineReadFromTUN()
go device.RoutineTUNEventReader()
diff --git a/device/tun.go b/device/tun.go
index ca3c91b..9ff6c23 100644
--- a/device/tun.go
+++ b/device/tun.go
@@ -47,5 +47,4 @@ func (device *Device) RoutineTUNEventReader() {
}
device.log.Verbosef("Routine: event worker - stopped")
- device.state.stopping.Done()
}