diff options
| author | Dan Engelbrecht <[email protected]> | 2023-05-11 10:52:14 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-05-11 10:52:14 +0200 |
| commit | 0049b60faea2b14f77a263b326a415c94cf4bad3 (patch) | |
| tree | 44c50579f116d53668123224bd26c218938fed83 /src/zenhttp/httpsys.cpp | |
| parent | ZEN_LOG_SCOPE compile fix (diff) | |
| download | zen-0049b60faea2b14f77a263b326a415c94cf4bad3.tar.xz zen-0049b60faea2b14f77a263b326a415c94cf4bad3.zip | |
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
Diffstat (limited to 'src/zenhttp/httpsys.cpp')
| -rw-r--r-- | src/zenhttp/httpsys.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
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 @@ -741,9 +741,19 @@ 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; } } |