File tree Expand file tree Collapse file tree 2 files changed +7
-6
lines changed
Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -76,12 +76,12 @@ class http_utils
7676
7777 enum start_method_T
7878 {
79- INTERNAL_SELECT = MHD_NO_FLAG,
8079#if defined(__MINGW32__) || defined(__CYGWIN32__)
81- THREAD = MHD_USE_THREAD_PER_CONNECTION | MHD_USE_POLL
80+ INTERNAL_SELECT = MHD_NO_FLAG,
8281#else
83- THREAD = MHD_USE_THREAD_PER_CONNECTION | MHD_USE_EPOLL_LINUX_ONLY
82+ INTERNAL_SELECT = MHD_NO_FLAG | MHD_USE_EPOLL_LINUX_ONLY | MHD_USE_EPOLL_TURBO,
8483#endif
84+ THREAD_PER_CONNECTION = MHD_USE_THREAD_PER_CONNECTION | MHD_USE_POLL
8585 };
8686
8787 enum policy_T
Original file line number Diff line number Diff line change @@ -383,11 +383,12 @@ bool webserver::start(bool blocking)
383383 iov.push_back (gen (MHD_OPTION_SOCK_ADDR, (intptr_t ) bind_address));
384384 if (bind_socket != 0 )
385385 iov.push_back (gen (MHD_OPTION_LISTEN_SOCKET, bind_socket));
386- if (! ( start_method == http_utils::INTERNAL_SELECT) )
386+ if (start_method == http_utils::THREAD_PER_CONNECTION && max_threads != 0 )
387387 {
388- if (max_threads != 0 )
389- iov. push_back ( gen (MHD_OPTION_THREAD_POOL_SIZE, max_threads) );
388+ cout << " Cannot specify maximum number of threads when using a thread per connection " << endl;
389+ throw ::httpserver::webserver_exception ( );
390390 }
391+
391392 if (max_connections != 0 )
392393 iov.push_back (gen (MHD_OPTION_CONNECTION_LIMIT, max_connections));
393394 if (memory_limit != 0 )
You can’t perform that action at this time.
0 commit comments