mirror of
https://github.com/tailscale/tailscale.git
synced 2025-02-18 02:48:40 +00:00
magicsock: work around race condition initializing .Regions[].
Signed-off-by: Avery Pennarun <apenwarr@tailscale.com>
This commit is contained in:
parent
7cd9ff3dde
commit
30e5c19214
@ -487,7 +487,12 @@ func (c *Conn) setNearestDERP(derpNum int) (wantDERP bool) {
|
||||
|
||||
// On change, notify all currently connected DERP servers and
|
||||
// start connecting to our home DERP if we are not already.
|
||||
c.logf("magicsock: home is now derp-%v (%v)", derpNum, c.derpMap.Regions[derpNum].RegionCode)
|
||||
dr := c.derpMap.Regions[derpNum]
|
||||
if dr == nil {
|
||||
c.logf("[unexpected] magicsock: derpMap.Regions[%v] is nil", derpNum)
|
||||
} else {
|
||||
c.logf("magicsock: home is now derp-%v (%v)", derpNum, c.derpMap.Regions[derpNum].RegionCode)
|
||||
}
|
||||
for i, ad := range c.activeDerp {
|
||||
go ad.c.NotePreferred(i == c.myDerp)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user