ipn/ipnlocal: move selfNode from peerAPIServer to peerAPIHandler
The peerAPIHandler is instantiated per PeerAPI call so it is guaranteed to have the latest selfNode. Signed-off-by: Maisem Ali <maisem@tailscale.com>
This commit is contained in:
@@ -449,6 +449,9 @@ func TestHandlePeerAPI(t *testing.T) {
|
||||
netip.MustParsePrefix("100.100.100.101/32"),
|
||||
},
|
||||
}
|
||||
if tt.debugCap {
|
||||
selfNode.Capabilities = append(selfNode.Capabilities, tailcfg.CapabilityDebug)
|
||||
}
|
||||
var e peerAPITestEnv
|
||||
lb := &LocalBackend{
|
||||
logf: e.logBuf.Logf,
|
||||
@@ -456,18 +459,15 @@ func TestHandlePeerAPI(t *testing.T) {
|
||||
netMap: &netmap.NetworkMap{SelfNode: selfNode},
|
||||
}
|
||||
e.ph = &peerAPIHandler{
|
||||
isSelf: tt.isSelf,
|
||||
isSelf: tt.isSelf,
|
||||
selfNode: selfNode,
|
||||
peerNode: &tailcfg.Node{
|
||||
ComputedName: "some-peer-name",
|
||||
},
|
||||
ps: &peerAPIServer{
|
||||
b: lb,
|
||||
selfNode: selfNode,
|
||||
b: lb,
|
||||
},
|
||||
}
|
||||
if tt.debugCap {
|
||||
e.ph.ps.selfNode.Capabilities = append(e.ph.ps.selfNode.Capabilities, tailcfg.CapabilityDebug)
|
||||
}
|
||||
var rootDir string
|
||||
if !tt.omitRoot {
|
||||
rootDir = t.TempDir()
|
||||
@@ -507,9 +507,6 @@ func TestFileDeleteRace(t *testing.T) {
|
||||
logf: t.Logf,
|
||||
capFileSharing: true,
|
||||
},
|
||||
selfNode: &tailcfg.Node{
|
||||
Addresses: []netip.Prefix{netip.MustParsePrefix("100.100.100.101/32")},
|
||||
},
|
||||
rootDir: dir,
|
||||
}
|
||||
ph := &peerAPIHandler{
|
||||
@@ -517,6 +514,9 @@ func TestFileDeleteRace(t *testing.T) {
|
||||
peerNode: &tailcfg.Node{
|
||||
ComputedName: "some-peer-name",
|
||||
},
|
||||
selfNode: &tailcfg.Node{
|
||||
Addresses: []netip.Prefix{netip.MustParsePrefix("100.100.100.101/32")},
|
||||
},
|
||||
ps: ps,
|
||||
}
|
||||
buf := make([]byte, 2<<20)
|
||||
|
||||
Reference in New Issue
Block a user