wgengine/magicsock: restore SetDERPMap signature, add SetDERPMapWithoutReSTUN
Commit 78627c132f changed the signature of magicsock.Conn.SetDERPMap to
take an additional bool doReStun parameter. Avoid both the boolean
parameter and the API signature change by restoring SetDERPMap to its
original single-argument form and adding a new SetDERPMapWithoutReSTUN
method for the cache-loading caller that wants to skip the post-set
ReSTUN.
Updates #19490
Change-Id: I97d9e82156bfc546ccf59756d1ea52f039b5de06
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
committed by
Brad Fitzpatrick
parent
1cd8bcc827
commit
22ff402da9
@@ -116,15 +116,15 @@ func TestSetDERPMapDoReStun(t *testing.T) {
|
||||
// spawning updateEndpoints.
|
||||
c.everHadKey = true
|
||||
|
||||
// Should not trigger a ReSTUN.
|
||||
c.SetDERPMap(derpMap1, false)
|
||||
// SetDERPMapWithoutReSTUN should not trigger a ReSTUN.
|
||||
c.SetDERPMapWithoutReSTUN(derpMap1)
|
||||
if reSTUNCalls != 0 {
|
||||
t.Errorf("SetDERPMap(dm, doReStun=false): got %d ReSTUN calls, want 0", reSTUNCalls)
|
||||
t.Errorf("SetDERPMapWithoutReSTUN: got %d ReSTUN calls, want 0", reSTUNCalls)
|
||||
}
|
||||
|
||||
// doReStun=true: should trigger a ReSTUN.
|
||||
c.SetDERPMap(derpMap2, true)
|
||||
// SetDERPMap should trigger a ReSTUN.
|
||||
c.SetDERPMap(derpMap2)
|
||||
if reSTUNCalls != 1 {
|
||||
t.Errorf("SetDERPMap(dm, doReStun=true): got %d ReSTUN calls, want 1", reSTUNCalls)
|
||||
t.Errorf("SetDERPMap: got %d ReSTUN calls, want 1", reSTUNCalls)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user