mirror of
https://git.zx2c4.com/wireguard-go
synced 2025-11-03 10:50:57 +08:00
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>
This commit is contained in:
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user