From 57b77fecb3a8f139daa105e6d38697fd4574fbef Mon Sep 17 00:00:00 2001 From: Jeff Becker Date: Mon, 31 Oct 2022 10:53:56 -0400 Subject: [PATCH] fix crash on shutdown we were calling llarp::Context::HandleSignal from a non mainloop thread when running as a win32 service. this caused issues with a non clean destruction. call our signal handler instead of llarp::Context::HandleSignal --- daemon/lokinet.cpp | 1 + llarp/win32/service_manager.cpp | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/daemon/lokinet.cpp b/daemon/lokinet.cpp index 3b576f504..b63361af8 100644 --- a/daemon/lokinet.cpp +++ b/daemon/lokinet.cpp @@ -601,6 +601,7 @@ SvcCtrlHandler(DWORD dwCtrl) // tell service we are stopping llarp::log::debug(logcat, "Windows service controller gave SERVICE_CONTROL_STOP"); llarp::sys::service_manager->system_changed_our_state(llarp::sys::ServiceState::Stopping); + handle_signal(SIGINT); return; case SERVICE_CONTROL_INTERROGATE: diff --git a/llarp/win32/service_manager.cpp b/llarp/win32/service_manager.cpp index 95f681809..0015158de 100644 --- a/llarp/win32/service_manager.cpp +++ b/llarp/win32/service_manager.cpp @@ -48,7 +48,6 @@ namespace llarp::sys if (st == ServiceState::Stopping) { we_changed_our_state(st); - m_Context->HandleSignal(SIGINT); } }