diff options
| author | Liam Mitchell <[email protected]> | 2026-02-04 14:45:08 -0800 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2026-02-04 14:45:08 -0800 |
| commit | 04697c9f880fddf4ba288bde9e159f2839651b27 (patch) | |
| tree | 929e505df185c8c7171942b0c2588401f8c57346 | |
| parent | 5.7.20-pre1 (diff) | |
| parent | Revert "Run Windows service as an interactive session, so we correctly respon... (diff) | |
| download | zen-04697c9f880fddf4ba288bde9e159f2839651b27.tar.xz zen-04697c9f880fddf4ba288bde9e159f2839651b27.zip | |
Merge pull request #723 from ue-foundation/lm/service-interactive-session
Run Windows service as an interactive session, so we correctly respond to RequestApplicationExit when requested to stop by the service manager
| -rw-r--r-- | src/zenhttp/servers/httpasio.cpp | 14 | ||||
| -rw-r--r-- | src/zenhttp/servers/httpmulti.cpp | 14 | ||||
| -rw-r--r-- | src/zenhttp/servers/httpnull.cpp | 14 | ||||
| -rw-r--r-- | src/zenhttp/servers/httpplugin.cpp | 14 |
4 files changed, 16 insertions, 40 deletions
diff --git a/src/zenhttp/servers/httpasio.cpp b/src/zenhttp/servers/httpasio.cpp index 9666a1d28..734c452ae 100644 --- a/src/zenhttp/servers/httpasio.cpp +++ b/src/zenhttp/servers/httpasio.cpp @@ -1970,23 +1970,17 @@ HttpAsioServer::OnInitialize(int BasePort, std::filesystem::path DataDir) void HttpAsioServer::OnRun(bool IsInteractive) { - const bool TestMode = !IsInteractive; - - int WaitTimeout = -1; - if (!TestMode) - { - WaitTimeout = 1000; - } + const int WaitTimeout = 1000; #if ZEN_PLATFORM_WINDOWS - if (TestMode == false) + if (IsInteractive) { ZEN_CONSOLE("Zen Server running (asio HTTP). Press ESC or Q to quit"); } do { - if (!TestMode && _kbhit() != 0) + if (IsInteractive && _kbhit() != 0) { char c = (char)_getch(); @@ -1999,7 +1993,7 @@ HttpAsioServer::OnRun(bool IsInteractive) m_ShutdownEvent.Wait(WaitTimeout); } while (!IsApplicationExitRequested()); #else - if (TestMode == false) + if (IsInteractive) { ZEN_CONSOLE("Zen Server running (asio HTTP). Ctrl-C to quit"); } diff --git a/src/zenhttp/servers/httpmulti.cpp b/src/zenhttp/servers/httpmulti.cpp index 6541a1c48..31cb04be5 100644 --- a/src/zenhttp/servers/httpmulti.cpp +++ b/src/zenhttp/servers/httpmulti.cpp @@ -56,23 +56,17 @@ HttpMultiServer::OnInitialize(int BasePort, std::filesystem::path DataDir) void HttpMultiServer::OnRun(bool IsInteractiveSession) { - const bool TestMode = !IsInteractiveSession; - - int WaitTimeout = -1; - if (!TestMode) - { - WaitTimeout = 1000; - } + const int WaitTimeout = 1000; #if ZEN_PLATFORM_WINDOWS - if (TestMode == false) + if (IsInteractiveSession) { ZEN_CONSOLE("Zen Server running (multi server). Press ESC or Q to quit"); } do { - if (!TestMode && _kbhit() != 0) + if (IsInteractiveSession && _kbhit() != 0) { char c = (char)_getch(); @@ -85,7 +79,7 @@ HttpMultiServer::OnRun(bool IsInteractiveSession) m_ShutdownEvent.Wait(WaitTimeout); } while (!IsApplicationExitRequested()); #else - if (TestMode == false) + if (IsInteractiveSession) { ZEN_CONSOLE("Zen Server running (null HTTP). Ctrl-C to quit"); } diff --git a/src/zenhttp/servers/httpnull.cpp b/src/zenhttp/servers/httpnull.cpp index 06838a0ed..0ec1cb3c4 100644 --- a/src/zenhttp/servers/httpnull.cpp +++ b/src/zenhttp/servers/httpnull.cpp @@ -34,23 +34,17 @@ HttpNullServer::OnInitialize(int BasePort, std::filesystem::path DataDir) void HttpNullServer::OnRun(bool IsInteractiveSession) { - const bool TestMode = !IsInteractiveSession; - - int WaitTimeout = -1; - if (!TestMode) - { - WaitTimeout = 1000; - } + const int WaitTimeout = 1000; #if ZEN_PLATFORM_WINDOWS - if (TestMode == false) + if (IsInteractiveSession) { ZEN_CONSOLE("Zen Server running (null HTTP). Press ESC or Q to quit"); } do { - if (!TestMode && _kbhit() != 0) + if (IsInteractiveSession && _kbhit() != 0) { char c = (char)_getch(); @@ -63,7 +57,7 @@ HttpNullServer::OnRun(bool IsInteractiveSession) m_ShutdownEvent.Wait(WaitTimeout); } while (!IsApplicationExitRequested()); #else - if (TestMode == false) + if (IsInteractiveSession) { ZEN_CONSOLE("Zen Server running (null HTTP). Ctrl-C to quit"); } diff --git a/src/zenhttp/servers/httpplugin.cpp b/src/zenhttp/servers/httpplugin.cpp index 7ee4c6e62..b9217ed87 100644 --- a/src/zenhttp/servers/httpplugin.cpp +++ b/src/zenhttp/servers/httpplugin.cpp @@ -790,23 +790,17 @@ HttpPluginServerImpl::OnRun(bool IsInteractive) { ZEN_MEMSCOPE(GetHttppluginTag()); - const bool TestMode = !IsInteractive; - - int WaitTimeout = -1; - if (!TestMode) - { - WaitTimeout = 1000; - } + const int WaitTimeout = 1000; # if ZEN_PLATFORM_WINDOWS - if (TestMode == false) + if (IsInteractive) { ZEN_CONSOLE("Zen Server running (plugin HTTP). Press ESC or Q to quit"); } do { - if (!TestMode && _kbhit() != 0) + if (IsInteractive && _kbhit() != 0) { char c = (char)_getch(); @@ -819,7 +813,7 @@ HttpPluginServerImpl::OnRun(bool IsInteractive) m_ShutdownEvent.Wait(WaitTimeout); } while (!IsApplicationExitRequested()); # else - if (TestMode == false) + if (IsInteractive) { ZEN_CONSOLE("Zen Server running (plugin HTTP). Ctrl-C to quit"); } |