This papers over other unrelated races, unfortunately.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
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)
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()