diff options
author | Josh Bleecher Snyder <josh@tailscale.com> | 2021-02-08 10:19:28 -0800 |
---|---|---|
committer | Josh Bleecher Snyder <josh@tailscale.com> | 2021-02-08 10:32:07 -0800 |
commit | 3516ccc1e226756c4ba6d431cbf7e3a3fe63c5f8 (patch) | |
tree | fd9c3fbda6f16129969ae6091496ab3cb1102f01 | |
parent | 0bcb822e5b4ee6408c5bcb5ad4d4e61b394a834e (diff) |
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>
-rw-r--r-- | device/device.go | 2 | ||||
-rw-r--r-- | device/tun.go | 1 |
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() } |