aboutsummaryrefslogtreecommitdiff
path: root/src/microhttpd/daemon.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/microhttpd/daemon.c')
-rw-r--r--src/microhttpd/daemon.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index 7d5b4e4a..abf2a1dc 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -3944,16 +3944,11 @@ MHD_select_thread (void *cls)
3944 MHD_cleanup_connections (daemon); 3944 MHD_cleanup_connections (daemon);
3945 } 3945 }
3946 3946
3947 /* give resumed formerly suspended connections a chance to 3947 /* Resume any pending for resume connections, join
3948 be included in the cleanup */ 3948 * all connection's threads (if any) and finally cleanup
3949 resume_suspended_connections (daemon); 3949 * everything. */
3950 /* run clean up in this thread as well */ 3950 close_all_connections (daemon);
3951 if (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) 3951
3952 {
3953 /* We did everything in this thread, so also the clean up */
3954 while (NULL != (pos = daemon->connections_head))
3955 close_connection (pos);
3956 }
3957 return (MHD_THRD_RTRN_TYPE_)0; 3952 return (MHD_THRD_RTRN_TYPE_)0;
3958} 3953}
3959 3954
@@ -5379,9 +5374,8 @@ thread_failed:
5379 5374
5380 5375
5381/** 5376/**
5382 * Close all connections for the daemon; must only be called after 5377 * Close all connections for the daemon.
5383 * all of the threads have been joined and there is no more concurrent 5378 * Must only be called when MHD_Daemon::shutdown was set to MHD_YES.
5384 * activity on the connection lists.
5385 * @remark To be called only from thread that process 5379 * @remark To be called only from thread that process
5386 * daemon's select()/poll()/etc. 5380 * daemon's select()/poll()/etc.
5387 * 5381 *
@@ -5396,7 +5390,11 @@ close_all_connections (struct MHD_Daemon *daemon)
5396 running into the check for there not being any suspended 5390 running into the check for there not being any suspended
5397 connections left in case of a tight race with a recently 5391 connections left in case of a tight race with a recently
5398 resumed connection. */ 5392 resumed connection. */
5399 resume_suspended_connections (daemon); 5393 if (0 != (MHD_USE_SUSPEND_RESUME & daemon->options))
5394 {
5395 daemon->resuming = MHD_YES; /* Force check for pending resume. */
5396 resume_suspended_connections (daemon);
5397 }
5400 /* first, make sure all threads are aware of shutdown; need to 5398 /* first, make sure all threads are aware of shutdown; need to
5401 traverse DLLs in peace... */ 5399 traverse DLLs in peace... */
5402 if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) 5400 if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION))
@@ -5569,7 +5567,6 @@ MHD_stop_daemon (struct MHD_Daemon *daemon)
5569 } 5567 }
5570 if (! MHD_join_thread_ (daemon->worker_pool[i].pid)) 5568 if (! MHD_join_thread_ (daemon->worker_pool[i].pid))
5571 MHD_PANIC (_("Failed to join a thread\n")); 5569 MHD_PANIC (_("Failed to join a thread\n"));
5572 close_all_connections (&daemon->worker_pool[i]);
5573 MHD_mutex_destroy_chk_ (&daemon->worker_pool[i].cleanup_connection_mutex); 5570 MHD_mutex_destroy_chk_ (&daemon->worker_pool[i].cleanup_connection_mutex);
5574#ifdef EPOLL_SUPPORT 5571#ifdef EPOLL_SUPPORT
5575 if (-1 != daemon->worker_pool[i].epoll_fd) 5572 if (-1 != daemon->worker_pool[i].epoll_fd)