diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2017-03-16 20:37:57 +0300 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2017-03-16 20:39:58 +0300 |
commit | 88374e04d2339297e75a34a798611bfb92225c4b (patch) | |
tree | 4fcb6dd06540dbee29d5a7a9bd6ef8ba0ff19623 /src/microhttpd/daemon.c | |
parent | 53ffa669927c58685c9013d6512693ae633cace0 (diff) | |
download | libmicrohttpd-88374e04d2339297e75a34a798611bfb92225c4b.tar.gz libmicrohttpd-88374e04d2339297e75a34a798611bfb92225c4b.zip |
Thread-safety: always lock mutex when modifying "cleanup" or "timeout" DL-lists
Diffstat (limited to 'src/microhttpd/daemon.c')
-rw-r--r-- | src/microhttpd/daemon.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c index 001c3586..d3b02c27 100644 --- a/src/microhttpd/daemon.c +++ b/src/microhttpd/daemon.c | |||
@@ -4403,6 +4403,9 @@ close_connection (struct MHD_Connection *pos) | |||
4403 | } | 4403 | } |
4404 | MHD_connection_close_ (pos, | 4404 | MHD_connection_close_ (pos, |
4405 | MHD_REQUEST_TERMINATED_DAEMON_SHUTDOWN); | 4405 | MHD_REQUEST_TERMINATED_DAEMON_SHUTDOWN); |
4406 | |||
4407 | MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex); | ||
4408 | |||
4406 | if (pos->connection_timeout == pos->daemon->connection_timeout) | 4409 | if (pos->connection_timeout == pos->daemon->connection_timeout) |
4407 | XDLL_remove (daemon->normal_timeout_head, | 4410 | XDLL_remove (daemon->normal_timeout_head, |
4408 | daemon->normal_timeout_tail, | 4411 | daemon->normal_timeout_tail, |
@@ -4417,6 +4420,8 @@ close_connection (struct MHD_Connection *pos) | |||
4417 | DLL_insert (daemon->cleanup_head, | 4420 | DLL_insert (daemon->cleanup_head, |
4418 | daemon->cleanup_tail, | 4421 | daemon->cleanup_tail, |
4419 | pos); | 4422 | pos); |
4423 | |||
4424 | MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex); | ||
4420 | } | 4425 | } |
4421 | 4426 | ||
4422 | 4427 | ||