From f60aec8607aa4ef70b4653d201c854b00a538951 Mon Sep 17 00:00:00 2001 From: Dan Engelbrecht Date: Thu, 21 Mar 2024 13:03:41 +0100 Subject: harden attach sponsor process (#14) - Improvement: Delay exiting due to no sponsor processes by one second to handle race conditions - Improvement: Safer IsProcessRunning check - Improvement: make sure we can RequestApplicationExit safely from any thread --- src/zenserver/main.cpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'src/zenserver/main.cpp') diff --git a/src/zenserver/main.cpp b/src/zenserver/main.cpp index b4cb2464b..a9246ed8f 100644 --- a/src/zenserver/main.cpp +++ b/src/zenserver/main.cpp @@ -210,11 +210,8 @@ ZenEntryPoint::Run() if (ShutdownEvent->Wait()) { - if (!IsApplicationExitRequested()) - { - ZEN_INFO("shutdown signal for pid {} received", zen::GetCurrentProcessId()); - Server.RequestExit(0); - } + ZEN_INFO("shutdown signal for pid {} received", zen::GetCurrentProcessId()); + Server.RequestExit(0); } else { @@ -253,10 +250,7 @@ ZenEntryPoint::Run() catch (std::exception& e) { ZEN_CRITICAL("Caught exception in main for process {}: {}", zen::GetCurrentProcessId(), e.what()); - if (!IsApplicationExitRequested()) - { - RequestApplicationExit(1); - } + RequestApplicationExit(1); } ShutdownServerLogging(); -- cgit v1.2.3