device: fix persistent_keepalive_interval data races

Co-authored-by: David Anderson <[email protected]>
Signed-off-by: Josh Bleecher Snyder <[email protected]>
This commit is contained in:
Josh Bleecher Snyder
2021-01-07 14:49:44 +01:00
committed by Jason A. Donenfeld
co-authored by David Anderson
parent e1fa1cc556
commit 63066ce406
5 changed files with 22 additions and 9 deletions
+1 -1
View File
@@ -163,7 +163,7 @@ func deviceUpdateState(device *Device) {
device.peers.RLock()
for _, peer := range device.peers.keyMap {
peer.Start()
if peer.persistentKeepaliveInterval > 0 {
if atomic.LoadUint32(&peer.persistentKeepaliveInterval) > 0 {
peer.SendKeepalive()
}
}