device: tie encryption queue lifetime to the peers that write to it
Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
This commit is contained in:
parent
4846070322
commit
8a374a35a0
3 changed files with 6 additions and 4 deletions
|
|
@ -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()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue