diff options
author | Josh Bleecher Snyder <josh@tailscale.com> | 2020-12-15 15:54:48 -0800 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2021-01-07 14:49:44 +0100 |
commit | 2832e96339b4b847172741e9252020fc7bfa59af (patch) | |
tree | 782633f9de39040f88930c905bca6d803a870f9e /device/peer.go | |
parent | 63066ce4062a85224821ce302e3eb8c34e95a658 (diff) |
device: use channel close to shut down and drain outbound channel
This is a similar treatment to the handling of the encryption
channel found a few commits ago: Use the closing of the channel
to manage goroutine lifetime and shutdown.
It is considerably simpler because there is only a single writer.
Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
Diffstat (limited to 'device/peer.go')
-rw-r--r-- | device/peer.go | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/device/peer.go b/device/peer.go index 31b75c7..c094160 100644 --- a/device/peer.go +++ b/device/peer.go @@ -17,7 +17,7 @@ import ( ) const ( - PeerRoutineNumber = 3 + PeerRoutineNumber = 2 ) type Peer struct { @@ -287,7 +287,6 @@ func (peer *Peer) Stop() { peer.queue.Lock() close(peer.queue.nonce) - close(peer.queue.outbound) close(peer.queue.inbound) peer.queue.Unlock() |