From 1fdfb0dd0870f3bb496b85255d1a893d6a5efd31 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Fri, 25 Nov 2022 07:22:20 -0800 Subject: [PATCH] ipn/localapi: add "enginestatus" debug command to LocalAPI To force an EngineStatus update to the IPN bus. This is a temporary measure while migrating the Windows GUI entirely to the LocalAPI and off the old IPN protocol. The old IPN protocol had RequestEngineStatus and LocalAPI didn't. Updates #6417 Change-Id: I8ff525fc3dd82bdd9d92c2bdad6db5b75609eacd Signed-off-by: Brad Fitzpatrick --- ipn/localapi/localapi.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/ipn/localapi/localapi.go b/ipn/localapi/localapi.go index ba4a5f5b4..0e401f770 100644 --- a/ipn/localapi/localapi.go +++ b/ipn/localapi/localapi.go @@ -439,6 +439,20 @@ func (h *Handler) serveDebug(w http.ResponseWriter, r *http.Request) { err = h.b.DebugRebind() case "restun": err = h.b.DebugReSTUN() + case "enginestatus": + // serveRequestEngineStatus kicks off a call to RequestEngineStatus (via + // LocalBackend => UserspaceEngine => LocalBackend => + // ipn.Notify{Engine}). + // + // This is a temporary (2022-11-25) measure for the Windows client's + // move to the LocalAPI HTTP interface. It was polling this over the IPN + // bus before every 2 seconds which is wasteful. We should add a bit to + // WatchIPNMask instead to let an IPN bus watcher say that it's + // interested in that info and then only send it on demand, not via + // polling. But for now we keep this interface because that's what the + // client already did. A future change will remove this, so don't depend + // on it. + h.b.RequestEngineStatus() case "": err = fmt.Errorf("missing parameter 'action'") default: