Skip to content

Commit a9b8351

Browse files
committed
Clarify that THREAD_PER_CONNECTION and max_thread_stack_size are incompatible
1 parent a72c56b commit a9b8351

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/webserver.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ bool webserver::start(bool blocking)
270270
// iov.push_back(gen(MHD_OPTION_SOCK_ADDR, (intptr_t) bind_address));
271271
if(bind_socket != 0)
272272
iov.push_back(gen(MHD_OPTION_LISTEN_SOCKET, bind_socket));
273-
if(start_method == http_utils::THREAD_PER_CONNECTION && max_threads != 0)
273+
if(start_method == http_utils::THREAD_PER_CONNECTION && (max_threads != 0 || max_thread_stack_size != 0))
274274
{
275275
throw std::invalid_argument("Cannot specify maximum number of threads when using a thread per connection");
276276
}

test/integ/ws_start_stop.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,15 @@ LT_BEGIN_AUTO_TEST(ws_start_stop_suite, thread_per_connection_fails_with_max_thr
301301
}
302302
LT_END_AUTO_TEST(thread_per_connection_fails_with_max_threads)
303303

304+
LT_BEGIN_AUTO_TEST(ws_start_stop_suite, thread_per_connection_fails_with_max_threads_stack_size)
305+
{
306+
webserver ws = create_webserver(8080)
307+
.start_method(http::http_utils::THREAD_PER_CONNECTION)
308+
.max_thread_stack_size(4*1024*1024);
309+
LT_CHECK_THROW(ws.start(false));
310+
}
311+
LT_END_AUTO_TEST(thread_per_connection_fails_with_max_threads_stack_size)
312+
304313
LT_BEGIN_AUTO_TEST(ws_start_stop_suite, tuning_options)
305314
webserver ws = create_webserver(8080)
306315
.max_connections(10)

0 commit comments

Comments
 (0)