mirror of
https://github.com/amnezia-vpn/amneziawg-go.git
synced 2025-04-16 14:06:54 +02:00
device: recheck counters while holding write lock
This commit is contained in:
parent
95fbfccf60
commit
ae492d1b35
1 changed files with 7 additions and 2 deletions
|
@ -315,8 +315,13 @@ func (device *Device) ConsumeMessageInitiation(msg *MessageInitiation) *Peer {
|
|||
handshake.chainKey = chainKey
|
||||
handshake.remoteIndex = msg.Sender
|
||||
handshake.remoteEphemeral = msg.Ephemeral
|
||||
handshake.lastTimestamp = timestamp
|
||||
handshake.lastInitiationConsumption = time.Now()
|
||||
if timestamp.After(handshake.lastTimestamp) {
|
||||
handshake.lastTimestamp = timestamp
|
||||
}
|
||||
now := time.Now()
|
||||
if now.After(handshake.lastInitiationConsumption) {
|
||||
handshake.lastInitiationConsumption = now
|
||||
}
|
||||
handshake.state = HandshakeInitiationConsumed
|
||||
|
||||
handshake.mutex.Unlock()
|
||||
|
|
Loading…
Add table
Reference in a new issue