mirror of
https://github.com/amnezia-vpn/amneziawg-go.git
synced 2026-10-14 22:34:18 +03:00
device: fix data race in peer.timersActive
Found by the race detector and existing tests. To avoid introducing a lock into this hot path, calculate and cache whether any peers exist. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
This commit is contained in:
1 parent
70861686d3
commit
f7bbdc31a0
3 files changed
+6
-3
No files matched your search
@@ -125,6 +125,7 @@ func (device *Device) NewPeer(pk NoisePublicKey) (*Peer, error) {
|
||||
// add
|
||||
|
||||
device.peers.keyMap[pk] = peer
|
||||
device.peers.empty.Set(false)
|
||||
|
||||
// start peer
|
||||
|
||||
|
||||
Reference in new issue
Block a user