wgengine/magicsock: revise derp fallback logic
Revision to earlier 6284454ae5
Don't be sticky if we have no peers.
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
committed by
Brad Fitzpatrick
parent
cbd8aceb95
commit
577f321c38
@@ -135,6 +135,15 @@ func TestPickDERPFallback(t *testing.T) {
|
||||
if got := c.pickDERPFallback(); got != someNode {
|
||||
t.Errorf("not sticky: got %v; want %v", got, someNode)
|
||||
}
|
||||
|
||||
// But move if peers are elsewhere.
|
||||
const otherNode = 789
|
||||
c.addrsByKey = map[key.Public]*AddrSet{
|
||||
key.Public{1}: &AddrSet{addrs: []net.UDPAddr{{IP: derpMagicIP, Port: otherNode}}},
|
||||
}
|
||||
if got := c.pickDERPFallback(); got != otherNode {
|
||||
t.Errorf("didn't join peers: got %v; want %v", got, someNode)
|
||||
}
|
||||
}
|
||||
|
||||
func makeConfigs(t *testing.T, ports []uint16) []wgcfg.Config {
|
||||
|
||||
Reference in New Issue
Block a user