ipn/{ipnlocal,localapi}, cli: add debug force-netmap-update

For loading testing & profiling the cost of full netmap updates.

Updates #1909

Change-Id: I0afdf5de9967f8d95c7f81d5b531ed1c92c3208f
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick
2023-09-24 08:08:28 -07:00
committed by Brad Fitzpatrick
parent 75dbd71f49
commit 04fabcd359
3 changed files with 24 additions and 0 deletions

View File

@@ -2133,6 +2133,23 @@ func (b *LocalBackend) DebugNotify(n ipn.Notify) {
b.send(n)
}
// DebugForceNetmapUpdate forces a full no-op netmap update of the current
// netmap in all the various subsystems (wireguard, magicsock, LocalBackend).
//
// It exists for load testing reasons (for issue 1909), doing what would happen
// if a new MapResponse came in from the control server that couldn't be handled
// incrementally.
func (b *LocalBackend) DebugForceNetmapUpdate() {
b.mu.Lock()
defer b.mu.Unlock()
nm := b.netMap
b.e.SetNetworkMap(nm)
if nm != nil {
b.magicConn().SetDERPMap(nm.DERPMap)
}
b.setNetMapLocked(nm)
}
// send delivers n to the connected frontend and any API watchers from
// LocalBackend.WatchNotifications (via the LocalAPI).
//