diff options
| author | Dan Engelbrecht <[email protected]> | 2023-09-14 03:54:57 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-09-14 09:54:57 +0200 |
| commit | e0da430c424192c24f5089ceb97f37062349e9ef (patch) | |
| tree | 2d83811f16839c1133a38b8a05c5ef1074a3701f /src/zenhttp/httpserver.cpp | |
| parent | disable access logging on shared instances (#403) (diff) | |
| download | zen-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/httpserver.cpp')
| -rw-r--r-- | src/zenhttp/httpserver.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/zenhttp/httpserver.cpp b/src/zenhttp/httpserver.cpp index 5312e80a2..a98a3c9bb 100644 --- a/src/zenhttp/httpserver.cpp +++ b/src/zenhttp/httpserver.cpp @@ -714,11 +714,8 @@ enum class HttpServerClass kHttpNull }; -// Implemented in httpsys.cpp -Ref<HttpServer> CreateHttpSysServer(int Concurrency, int BackgroundWorkerThreads); - Ref<HttpServer> -CreateHttpServer(std::string_view ServerClass) +CreateHttpServer(const HttpServerConfig& Config) { using namespace std::literals; @@ -730,15 +727,15 @@ CreateHttpServer(std::string_view ServerClass) Class = HttpServerClass::kHttpAsio; #endif - if (ServerClass == "asio"sv) + if (Config.ServerClass == "asio"sv) { Class = HttpServerClass::kHttpAsio; } - else if (ServerClass == "httpsys"sv) + else if (Config.ServerClass == "httpsys"sv) { Class = HttpServerClass::kHttpSys; } - else if (ServerClass == "null"sv) + else if (Config.ServerClass == "null"sv) { Class = HttpServerClass::kHttpNull; } @@ -748,12 +745,15 @@ CreateHttpServer(std::string_view ServerClass) default: case HttpServerClass::kHttpAsio: ZEN_INFO("using asio HTTP server implementation"); - return Ref<HttpServer>(new HttpAsioServer()); + return Ref<HttpServer>(new HttpAsioServer(Config.ThreadCount)); #if ZEN_WITH_HTTPSYS case HttpServerClass::kHttpSys: ZEN_INFO("using http.sys server implementation"); - return Ref<HttpServer>(new HttpSysServer(std::thread::hardware_concurrency(), /* background worker threads */ 16)); + return Ref<HttpServer>(new HttpSysServer({.ThreadCount = Config.ThreadCount, + .AsyncWorkThreadCount = Config.HttpSys.AsyncWorkThreadCount, + .IsAsyncResponseEnabled = Config.HttpSys.IsAsyncResponseEnabled, + .IsRequestLoggingEnabled = Config.HttpSys.IsRequestLoggingEnabled})); #endif case HttpServerClass::kHttpNull: |