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>
This commit is contained in:
Josh Bleecher Snyder 2021-02-08 10:19:28 -08:00
parent 0bcb822e5b
commit 3516ccc1e2
2 changed files with 1 additions and 2 deletions

View File

@ -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()

View File

@ -47,5 +47,4 @@ func (device *Device) RoutineTUNEventReader() {
}
device.log.Verbosef("Routine: event worker - stopped")
device.state.stopping.Done()
}