aboutsummaryrefslogtreecommitdiffstats
path: root/receive.go
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-05-20 06:50:07 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2018-05-20 06:50:07 +0200
commitacb5481246ea97bff64cc3eba1fa4255fc1ccd72 (patch)
treecab32a55aac483eb25e5a8c944d14e10f4610cd3 /receive.go
parentFix race with closing event channel (diff)
downloadwireguard-go-acb5481246ea97bff64cc3eba1fa4255fc1ccd72.tar.xz
wireguard-go-acb5481246ea97bff64cc3eba1fa4255fc1ccd72.zip
Fix data races in timers
Diffstat (limited to 'receive.go')
-rw-r--r--receive.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/receive.go b/receive.go
index 29fe5e9..56e65e7 100644
--- a/receive.go
+++ b/receive.go
@@ -105,12 +105,12 @@ func (device *Device) addToHandshakeQueue(
* NOTE: Not thread safe, but called by sequential receiver!
*/
func (peer *Peer) keepKeyFreshReceiving() {
- if peer.timers.sentLastMinuteHandshake {
+ if peer.timers.sentLastMinuteHandshake.Get() {
return
}
keypair := peer.keypairs.Current()
if keypair != nil && keypair.isInitiator && time.Now().Sub(keypair.created) > (RejectAfterTime-KeepaliveTimeout-RekeyTimeout) {
- peer.timers.sentLastMinuteHandshake = true
+ peer.timers.sentLastMinuteHandshake.Set(true)
peer.SendHandshakeInitiation(false)
}
}