Mercurial > hg > orthanc
diff Core/HttpServer/MongooseServer.cpp @ 2903:1153b1a128fe
MongooseServer::SetThreadsCount()
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 23 Oct 2018 17:32:56 +0200 |
parents | da43ef7ff32a |
children | d924f9bb61cc |
line wrap: on
line diff
--- a/Core/HttpServer/MongooseServer.cpp Tue Oct 23 12:05:19 2018 +0200 +++ b/Core/HttpServer/MongooseServer.cpp Tue Oct 23 17:32:56 2018 +0200 @@ -919,6 +919,7 @@ httpCompression_ = true; exceptionFormatter_ = NULL; realm_ = ORTHANC_REALM; + threadsCount_ = 50; // Default value in mongoose #if ORTHANC_ENABLE_SSL == 1 // Check for the Heartbleed exploit @@ -957,6 +958,7 @@ if (!IsRunning()) { std::string port = boost::lexical_cast<std::string>(port_); + std::string numThreads = boost::lexical_cast<std::string>(threadsCount_); if (ssl_) { @@ -975,6 +977,9 @@ // https://github.com/civetweb/civetweb/blob/master/docs/UserManual.md#enable_keep_alive-no "keep_alive_timeout_ms", (keepAlive_ ? "500" : "0"), #endif + + // Set the number of threads + "num_threads", numThreads.c_str(), // Set the SSL certificate, if any. This must be the last option. ssl_ ? "ssl_certificate" : NULL, @@ -1125,4 +1130,16 @@ return *handler_; } + + + void MongooseServer::SetThreadsCount(unsigned int threads) + { + if (threads <= 0) + { + throw OrthancException(ErrorCode_ParameterOutOfRange); + } + + Stop(); + threadsCount_ = threads; + } }