fix: cleanly stop CAT (and release relay handles) on shutdown — FlexRadio kept our API client registered, making the next launch take ~30s to reconnect
This commit is contained in:
@@ -1193,8 +1193,15 @@ func (a *App) runShutdownTasks(ctx context.Context, steps []shutdownStep) {
|
|||||||
a.emitShutdownEvent("shutdown:update", steps)
|
a.emitShutdownEvent("shutdown:update", steps)
|
||||||
}
|
}
|
||||||
a.emitShutdownEvent("shutdown:done", steps)
|
a.emitShutdownEvent("shutdown:done", steps)
|
||||||
// Give the UI a moment to show the "done" state before we yank the
|
// Cleanly tear down hardware links before quitting. Especially the CAT
|
||||||
// window away. 600ms feels purposeful without being annoying.
|
// backend: a FlexRadio keeps our API client registered until it notices the
|
||||||
|
// TCP is gone, and just letting the process exit left the slot stale — the
|
||||||
|
// NEXT launch then spent ~30s retrying the connect before the radio freed it.
|
||||||
|
// cat.Stop() closes the socket with a proper FIN so the radio drops us at once.
|
||||||
|
if a.cat != nil {
|
||||||
|
a.cat.Stop()
|
||||||
|
}
|
||||||
|
a.closeRelayDrivers() // release FTDI/serial relay handles for the next launch
|
||||||
time.Sleep(600 * time.Millisecond)
|
time.Sleep(600 * time.Millisecond)
|
||||||
wruntime.Quit(ctx)
|
wruntime.Quit(ctx)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user