mirror of
https://github.com/tailscale/tailscale.git
synced 2025-02-18 02:48:40 +00:00
magicsock: start connection to HOME derp immediately
The code as written intended to do this, but it repeated the comparison of derpNum and c.myDerp after c.myDerp had been updated, so it never executed. Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
This commit is contained in:
parent
73cae4eb11
commit
455ba751d9
@ -400,13 +400,14 @@ func (c *Conn) setNearestDERP(derpNum int) (wantDERP bool) {
|
||||
// No change.
|
||||
return true
|
||||
}
|
||||
// On change, notify all currently connected DERP servers and
|
||||
// start connecting to our home DERP if we are not already.
|
||||
c.myDerp = derpNum
|
||||
c.logf("home DERP server is now %v, %v", derpNum, c.derps.ServerByID(derpNum))
|
||||
for i, ad := range c.activeDerp {
|
||||
go ad.c.NotePreferred(i == c.myDerp)
|
||||
}
|
||||
if derpNum != 0 && derpNum != c.myDerp {
|
||||
// On change, start connecting to it:
|
||||
if derpNum != 0 {
|
||||
go c.derpWriteChanOfAddr(&net.UDPAddr{IP: derpMagicIP, Port: derpNum})
|
||||
}
|
||||
return true
|
||||
|
Loading…
x
Reference in New Issue
Block a user