From 0049b60faea2b14f77a263b326a415c94cf4bad3 Mon Sep 17 00:00:00 2001 From: Dan Engelbrecht Date: Thu, 11 May 2023 10:52:14 +0200 Subject: Close down http server gracefully when exiting even while requests are still being processed (#290) * Close down http server gracefully when exiting even while requests are still being processed --- src/zenhttp/httpsys.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/zenhttp/httpsys.cpp') diff --git a/src/zenhttp/httpsys.cpp b/src/zenhttp/httpsys.cpp index c733d618d..25e4393b3 100644 --- a/src/zenhttp/httpsys.cpp +++ b/src/zenhttp/httpsys.cpp @@ -738,12 +738,22 @@ HttpSysServer::HttpSysServer(unsigned int ThreadCount, unsigned int AsyncWorkThr } HttpSysServer::~HttpSysServer() +{ + if (m_IsHttpInitialized) + { + ZEN_ERROR("~HttpSysServer() called without calling Close() first"); + } +} + +void +HttpSysServer::Close() { if (m_IsHttpInitialized) { Cleanup(); HttpTerminate(HTTP_INITIALIZE_SERVER, nullptr); + m_IsHttpInitialized = false; } } -- cgit v1.2.3