mirror of
https://github.com/amnezia-vpn/amneziawg-go.git
synced 2026-10-14 22:34:18 +03:00
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:
1 parent
4846070322
commit
8a374a35a0
3 files changed
+6
-4
No files matched your search
@@ -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()
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user