From 2832e96339b4b847172741e9252020fc7bfa59af Mon Sep 17 00:00:00 2001 From: Josh Bleecher Snyder Date: Tue, 15 Dec 2020 15:54:48 -0800 Subject: 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 --- device/peer.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'device/peer.go') 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() -- cgit v1.2.3