1
0
mirror of https://git.zx2c4.com/wireguard-go synced 2024-11-15 01:05:15 +01:00

device: take peer handshake when reinitializing last sent handshake

This papers over other unrelated races, unfortunately.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jason A. Donenfeld 2021-02-03 17:52:31 +01:00
parent 91617b4c52
commit 01e176af3c

View File

@ -171,6 +171,10 @@ func (peer *Peer) Start() {
peer.stopping.Wait()
peer.stopping.Add(2)
peer.handshake.mutex.Lock()
peer.handshake.lastSentHandshake = time.Now().Add(-(RekeyTimeout + time.Second))
peer.handshake.mutex.Unlock()
// prepare queues
peer.queue.outbound = make(chan *QueueOutboundElement, QueueOutboundSize)
peer.queue.inbound = make(chan *QueueInboundElement, QueueInboundSize)
@ -180,7 +184,6 @@ func (peer *Peer) Start() {
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))
go peer.RoutineSequentialSender()
go peer.RoutineSequentialReceiver()