aboutsummaryrefslogtreecommitdiff
path: root/src/zenhttp/httpasio.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/httpasio.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/httpasio.cpp')
-rw-r--r--src/zenhttp/httpasio.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/zenhttp/httpasio.cpp b/src/zenhttp/httpasio.cpp
index e12125bcc..4d1f35c2b 100644
--- a/src/zenhttp/httpasio.cpp
+++ b/src/zenhttp/httpasio.cpp
@@ -1339,7 +1339,9 @@ HttpAsioServerImpl::RouteRequest(std::string_view Url)
//////////////////////////////////////////////////////////////////////////
namespace zen {
-HttpAsioServer::HttpAsioServer() : m_Impl(std::make_unique<asio_http::HttpAsioServerImpl>())
+HttpAsioServer::HttpAsioServer(unsigned int ThreadCount)
+: m_ThreadCount(ThreadCount != 0 ? ThreadCount : Max(std::thread::hardware_concurrency(), 8u))
+, m_Impl(std::make_unique<asio_http::HttpAsioServerImpl>())
{
ZEN_DEBUG("Request object size: {} ({:#x})", sizeof(asio_http::HttpRequest), sizeof(asio_http::HttpRequest));
}
@@ -1375,7 +1377,7 @@ HttpAsioServer::RegisterService(HttpService& Service)
int
HttpAsioServer::Initialize(int BasePort)
{
- m_BasePort = m_Impl->Start(gsl::narrow<uint16_t>(BasePort), Max(std::thread::hardware_concurrency(), 8u));
+ m_BasePort = m_Impl->Start(gsl::narrow<uint16_t>(BasePort), m_ThreadCount);
return m_BasePort;
}