aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeny Grin (Karlson2k) <k2k@narod.ru>2017-03-16 21:58:16 +0300
committerEvgeny Grin (Karlson2k) <k2k@narod.ru>2017-03-16 21:58:16 +0300
commitac82c4d331f864f2100db4c3ffce16a5c34042e7 (patch)
tree7c6a5a13d0c14f2410498496bcde43de37368639
parent76500135fe570921bc86093bb84872e17f1fe1cb (diff)
downloadlibmicrohttpd-ac82c4d331f864f2100db4c3ffce16a5c34042e7.tar.gz
libmicrohttpd-ac82c4d331f864f2100db4c3ffce16a5c34042e7.zip
Improved thread-safe for MHD_set_connection_option()
-rw-r--r--src/microhttpd/connection.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index 20bde652..c3c7be8b 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -3373,6 +3373,7 @@ MHD_set_connection_option (struct MHD_Connection *connection,
3373 switch (option) 3373 switch (option)
3374 { 3374 {
3375 case MHD_CONNECTION_OPTION_TIMEOUT: 3375 case MHD_CONNECTION_OPTION_TIMEOUT:
3376 MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex);
3376 if ( (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) && 3377 if ( (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) &&
3377 (! connection->suspended) ) 3378 (! connection->suspended) )
3378 { 3379 {
@@ -3401,6 +3402,7 @@ MHD_set_connection_option (struct MHD_Connection *connection,
3401 daemon->manual_timeout_tail, 3402 daemon->manual_timeout_tail,
3402 connection); 3403 connection);
3403 } 3404 }
3405 MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex);
3404 return MHD_YES; 3406 return MHD_YES;
3405 default: 3407 default:
3406 return MHD_NO; 3408 return MHD_NO;