diff options
author | Josh Bleecher Snyder <josh@tailscale.com> | 2021-02-02 10:46:34 -0800 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2021-02-03 00:57:57 +0100 |
commit | 8a374a35a0fe62dfd86df2c16166d2bb84115b93 (patch) | |
tree | d712eee9dbb5772f9dd922a15b168a50ba74169d /device/peer.go | |
parent | 48460703229d73fbacdd0d6b0d0f01a54f7ce751 (diff) |
device: tie encryption queue lifetime to the peers that write to it
Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
Diffstat (limited to 'device/peer.go')
-rw-r--r-- | device/peer.go | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/device/peer.go b/device/peer.go index 76f9a96..65f73a9 100644 --- a/device/peer.go +++ b/device/peer.go @@ -177,6 +177,7 @@ func (peer *Peer) Start() { if peer.queue.staged == nil { peer.queue.staged = make(chan *QueueOutboundElement, QueueStagedSize) } + peer.device.queue.encryption.wg.Add(1) // keep encryption queue open for our writes peer.timersInit() peer.handshake.lastSentHandshake = time.Now().Add(-(RekeyTimeout + time.Second)) @@ -248,6 +249,7 @@ func (peer *Peer) Stop() { close(peer.queue.inbound) close(peer.queue.outbound) peer.stopping.Wait() + peer.device.queue.encryption.wg.Done() // no more writes to encryption queue from us peer.ZeroAndFlushAll() } |