aboutsummaryrefslogtreecommitdiff
path: root/src/zenhttp/httpsys.cpp
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2023-09-14 03:54:57 -0400
committerGitHub <[email protected]>2023-09-14 09:54:57 +0200
commite0da430c424192c24f5089ceb97f37062349e9ef (patch)
tree2d83811f16839c1133a38b8a05c5ef1074a3701f /src/zenhttp/httpsys.cpp
parentdisable access logging on shared instances (#403) (diff)
downloadzen-e0da430c424192c24f5089ceb97f37062349e9ef.tar.xz
zen-e0da430c424192c24f5089ceb97f37062349e9ef.zip
http and httpsys config options (#401)
* Added `--http-threads`, `--httpsys-async-work-threads`, `--httpsys-enable-request-logging` and `--httpsys-enable-async-response` command line options to zenserver * remove unused CreateHttpSysServer
Diffstat (limited to 'src/zenhttp/httpsys.cpp')
-rw-r--r--src/zenhttp/httpsys.cpp16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/zenhttp/httpsys.cpp b/src/zenhttp/httpsys.cpp
index 0b06f0558..2f8e0a898 100644
--- a/src/zenhttp/httpsys.cpp
+++ b/src/zenhttp/httpsys.cpp
@@ -721,11 +721,13 @@ HttpAsyncWorkRequest::AsyncWorkItem::Execute()
\/ \/ \/
*/
-HttpSysServer::HttpSysServer(unsigned int ThreadCount, unsigned int AsyncWorkThreadCount)
+HttpSysServer::HttpSysServer(const Config& Config)
: m_Log(logging::Get("http"))
, m_RequestLog(logging::Get("http_requests"))
-, m_ThreadPool(ThreadCount)
-, m_AsyncWorkPool(AsyncWorkThreadCount, "http_async")
+, m_IsRequestLoggingEnabled(Config.IsRequestLoggingEnabled)
+, m_IsAsyncResponseEnabled(Config.IsAsyncResponseEnabled)
+, m_ThreadPool(Config.ThreadCount != 0 ? Config.ThreadCount : std::thread::hardware_concurrency())
+, m_AsyncWorkPool(Config.AsyncWorkThreadCount != 0 ? Config.AsyncWorkThreadCount : 16, "http_async")
{
ULONG Result = HttpInitialize(HTTPAPI_VERSION_2, HTTP_INITIALIZE_SERVER, nullptr);
@@ -737,7 +739,7 @@ HttpSysServer::HttpSysServer(unsigned int ThreadCount, unsigned int AsyncWorkThr
m_IsHttpInitialized = true;
m_IsOk = true;
- ZEN_INFO("http.sys server started, using {} I/O threads and {} async worker threads", ThreadCount, AsyncWorkThreadCount);
+ ZEN_INFO("http.sys server started, using {} I/O threads and {} async worker threads", Config.ThreadCount, Config.AsyncWorkThreadCount);
}
HttpSysServer::~HttpSysServer()
@@ -1697,11 +1699,5 @@ HttpSysServer::RegisterService(HttpService& Service)
RegisterService(Service.BaseUri(), Service);
}
-Ref<HttpServer>
-CreateHttpSysServer(int Concurrency, int BackgroundWorkerThreads)
-{
- return Ref<HttpServer>(new HttpSysServer(Concurrency, BackgroundWorkerThreads));
-}
-
} // namespace zen
#endif