control/controlclient: avoid calls to ms.netmap() (#19281)

Instead of generating the full netmap, just fetch the peers out the the
existing peers map.

The extra usage was introduced with netmap caching, but there is no need
to call the netmap to get this information, rather the existing peermap
can be used.

Updates #12639

Signed-off-by: Claus Lensbøl <claus@tailscale.com>
This commit is contained in:
Claus Lensbøl
2026-04-08 09:01:07 -04:00
committed by GitHub
parent 5341b26328
commit 9e68841939
2 changed files with 13 additions and 18 deletions
+3 -4
View File
@@ -696,13 +696,12 @@ func TestUpdateDiscoForNode(t *testing.T) {
ms.updateDiscoForNode(node.ID, node.Key, newKey.Public(), tt.updateLastSeen, tt.updateOnline)
<-nu.done
nm := ms.netmap()
peerIdx := nm.PeerIndexByNodeID(node.ID)
if peerIdx == -1 {
peer, ok := ms.peers[node.ID]
if !ok {
t.Fatal("node not found")
}
updated := nm.Peers[peerIdx].DiscoKey().Compare(newKey.Public()) == 0
updated := peer.DiscoKey().Compare(newKey.Public()) == 0
if updated != tt.wantUpdate {
t.Fatalf("Disco key update: %t, wanted update: %t", updated, tt.wantUpdate)
}