Skip to content

Commit de7c702

Browse files
committed
device: only propagate roaming value before peer is referenced elsewhere
A peer.endpoint never becomes nil after being not-nil, so creation is the only time we actually need to set this. This prevents a race from when the variable is actually used elsewhere, and allows us to avoid an expensive atomic. Signed-off-by: Jason A. Donenfeld <[email protected]>
1 parent fc4f975 commit de7c702

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

device/uapi.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,9 @@ func (peer *ipcSetPeer) handlePostConfig() {
261261
if peer.Peer == nil || peer.dummy {
262262
return
263263
}
264-
peer.disableRoaming = peer.device.net.brokenRoaming && peer.endpoint != nil
264+
if peer.created {
265+
peer.disableRoaming = peer.device.net.brokenRoaming && peer.endpoint != nil
266+
}
265267
if peer.device.isUp() {
266268
peer.Start()
267269
if peer.pkaOn {

0 commit comments

Comments
 (0)