diff options
Diffstat (limited to 'src/microhttpd/daemon.c')
-rw-r--r-- | src/microhttpd/daemon.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c index 5fab773c..42c747c8 100644 --- a/src/microhttpd/daemon.c +++ b/src/microhttpd/daemon.c | |||
@@ -6985,6 +6985,17 @@ MHD_start_daemon_va (unsigned int flags, | |||
6985 | } | 6985 | } |
6986 | } | 6986 | } |
6987 | } | 6987 | } |
6988 | else | ||
6989 | { /* Daemon without internal threads */ | ||
6990 | if (! MHD_mutex_init_ (&d->new_connections_mutex)) | ||
6991 | { | ||
6992 | #ifdef HAVE_MESSAGES | ||
6993 | MHD_DLOG (daemon, | ||
6994 | _ ("Failed to initialise mutex.\n")); | ||
6995 | #endif | ||
6996 | goto free_and_fail; | ||
6997 | } | ||
6998 | } | ||
6988 | #endif | 6999 | #endif |
6989 | #ifdef HTTPS_SUPPORT | 7000 | #ifdef HTTPS_SUPPORT |
6990 | /* API promises to never use the password after initialization, | 7001 | /* API promises to never use the password after initialization, |
@@ -7372,12 +7383,16 @@ MHD_stop_daemon (struct MHD_Daemon *daemon) | |||
7372 | MHD_PANIC (_ ("Failed to join a thread.\n")); | 7383 | MHD_PANIC (_ ("Failed to join a thread.\n")); |
7373 | } | 7384 | } |
7374 | /* close_all_connections() was called in daemon thread. */ | 7385 | /* close_all_connections() was called in daemon thread. */ |
7386 | MHD_mutex_destroy_chk_ (&daemon->new_connections_mutex); | ||
7375 | } | 7387 | } |
7376 | else | 7388 | else |
7377 | #endif | 7389 | #endif |
7378 | { | 7390 | { |
7379 | /* No internal threads are used for polling sockets. */ | 7391 | /* No internal threads are used for polling sockets. */ |
7380 | close_all_connections (daemon); | 7392 | close_all_connections (daemon); |
7393 | #if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS) | ||
7394 | MHD_mutex_destroy_chk_ (&daemon->new_connections_mutex); | ||
7395 | #endif /* MHD_USE_POSIX_THREADS || MHD_USE_W32_THREADS */ | ||
7381 | } | 7396 | } |
7382 | mhd_assert (NULL == daemon->connections_head); | 7397 | mhd_assert (NULL == daemon->connections_head); |
7383 | mhd_assert (NULL == daemon->cleanup_head); | 7398 | mhd_assert (NULL == daemon->cleanup_head); |
@@ -7389,7 +7404,6 @@ MHD_stop_daemon (struct MHD_Daemon *daemon) | |||
7389 | 7404 | ||
7390 | if (MHD_ITC_IS_VALID_ (daemon->itc)) | 7405 | if (MHD_ITC_IS_VALID_ (daemon->itc)) |
7391 | MHD_itc_destroy_chk_ (daemon->itc); | 7406 | MHD_itc_destroy_chk_ (daemon->itc); |
7392 | MHD_mutex_destroy_chk_ (&daemon->new_connections_mutex); | ||
7393 | 7407 | ||
7394 | #ifdef EPOLL_SUPPORT | 7408 | #ifdef EPOLL_SUPPORT |
7395 | if ( (0 != (daemon->options & MHD_USE_EPOLL)) && | 7409 | if ( (0 != (daemon->options & MHD_USE_EPOLL)) && |