diff --git a/coordinator/startup.lua b/coordinator/startup.lua index 2ed9fdb..8b42414 100644 --- a/coordinator/startup.lua +++ b/coordinator/startup.lua @@ -144,7 +144,7 @@ local function main() ---@class crd_state crd_state = { fp_ok = false, - ui_ok = false, + ui_ok = true, -- default true, used to abort on fail link_fail = false, shutdown = false }, diff --git a/coordinator/threads.lua b/coordinator/threads.lua index 7a433f5..8fac12b 100644 --- a/coordinator/threads.lua +++ b/coordinator/threads.lua @@ -190,16 +190,21 @@ function threads.thread__main(smem) sounder.continue() end - -- check for termination request + -- check for termination request or UI crash if event == "terminate" or ppm.should_terminate() then crd_state.shutdown = true log.info("terminate requested, main thread exiting") + elseif not crd_state.ui_ok then + crd_state.shutdown = true + log.info("terminating due to fatal UI error") + end + if crd_state.shutdown then -- handle closing supervisor connection coord_comms.try_connect(true) if coord_comms.is_linked() then - log_comms("terminate requested, closing supervisor connection...") + log_comms("closing supervisor connection...") else crd_state.link_fail = true end coord_comms.close()