libmicrohttpd

HTTP/1.x server C library (MHD 1.x, stable)
Log | Files | Refs | Submodules | README | LICENSE

commit 334974b4b18840b88c3332ba68863f6c9394b46d
parent 6d68b2d3af8881af035259d24d80aabe6bf93c22
Author: Christian Grothoff <christian@grothoff.org>
Date:   Sat,  4 Apr 2015 16:30:00 +0000

fix multi-threaded shutdown deadlock issue

Diffstat:
MChangeLog | 4++++
Msrc/include/microhttpd.h | 4++--
Msrc/microhttpd/daemon.c | 2++
Msrc/testcurl/test_concurrent_stop.c | 2+-
4 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -1,3 +1,7 @@ +Sat Apr 4 18:28:24 CEST 2015 + Fix potential deadlock issue in MHD_USE_THREAD_PER_CONNECTION + mode if shutdown is initiated while connections are active. -CG + Sat Apr 4 17:48:13 CEST 2015 Fix issue in thread-pool mode where a MHD_stop_daemon() might not reach threads that stopped listening because diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h @@ -130,7 +130,7 @@ typedef intptr_t ssize_t; * Current version of the library. * 0x01093001 = 1.9.30-1. */ -#define MHD_VERSION 0x00093906 +#define MHD_VERSION 0x00093907 /** * MHD-internal return code for "YES". @@ -2643,7 +2643,7 @@ enum MHD_FEATURE /** * Get whether password encrypted private key for HTTPS daemon is - * supported. If supported then option + * supported. If supported then option * ::MHD_OPTION_HTTPS_KEY_PASSWORD can be used. */ MHD_FEATURE_HTTPS_KEY_PASSWORD = 14 diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c @@ -4213,6 +4213,8 @@ close_connection (struct MHD_Connection *pos) MHD_connection_close (pos, MHD_REQUEST_TERMINATED_DAEMON_SHUTDOWN); + if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) + return; /* must let thread to the rest */ if (pos->connection_timeout == pos->daemon->connection_timeout) XDLL_remove (daemon->normal_timeout_head, daemon->normal_timeout_tail, diff --git a/src/testcurl/test_concurrent_stop.c b/src/testcurl/test_concurrent_stop.c @@ -217,7 +217,7 @@ main (int argc, char *const *argv) response = MHD_create_response_from_buffer (strlen ("/hello_world"), "/hello_world", MHD_RESPMEM_MUST_COPY); - // errorCount += testMultithreadedGet (port++, 0); + errorCount += testMultithreadedGet (port++, 0); errorCount += testMultithreadedPoolGet (port++, 0); MHD_destroy_response (response); if (errorCount != 0)