mirror of
https://github.com/netbirdio/netbird.git
synced 2026-07-21 16:01:28 +02:00
Remove the DownAsync RPC and call the plain Down RPC from the tray Quit
handler under the existing 5s client-side deadline.
Why DownAsync did not pay for itself:
- Its premise ("quitting never blocks on the engine shutdown") did not
hold: engine.Stop() ran synchronously inside beginDown, so the GUI
blocked on it either way. Only the retry-goroutine wait (typically
near-zero, at most 5s when wedged) moved off the caller.
- The daemon's Down handler never consults the caller's context, so the
client-side deadline in handleQuit already bounds how long Quit waits
while the daemon completes the full teardown regardless of the caller
timing out. Same disconnect guarantee, no extra API surface.
- A DownAsync that truly returned before the engine shutdown would have
to return right after actCancel and stop the engine on a background
goroutine, opening an Up-after-Down race (new engine starting while
the old one is still tearing down) that would need an Up-side guard.
That is a connect-lifecycle refactor (see the TODO in
cleanupConnection about run-loop shutdown ownership), not a quit-UX
fix.
Down keeps the error handling from the previous commit: engine.Stop()
failures are logged and cleanup continues so the daemon always returns
to Idle, and ErrServiceNotUp returns without an error log. The generated
proto files are restored to their previous content rather than
regenerated.
79 KiB
79 KiB