libmicrohttpd

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

commit 4e416de4c5ff7c87fa34d3f68764fad65f45a62b
parent eb1a0307e5c007790bf6cc4d1a7bb018c3008ccf
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date:   Thu, 29 Oct 2020 15:37:19 +0300

daemon.c: added cleanup asserts

Diffstat:
Msrc/microhttpd/daemon.c | 13++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c @@ -3159,13 +3159,14 @@ resume_suspended_connections (struct MHD_Daemon *daemon) & MHD_USE_THREAD_PER_CONNECTION)); #if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS) mhd_assert (NULL == daemon->worker_pool); + mhd_assert ( (0 == (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) || \ + MHD_thread_ID_match_current_ (daemon->pid) ); #endif + ret = MHD_NO; #if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS) MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex); #endif - mhd_assert ( (0 == (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD)) || \ - MHD_thread_ID_match_current_ (daemon->pid) ); if (daemon->resuming) { @@ -6646,7 +6647,7 @@ MHD_start_daemon_va (unsigned int flags, #ifdef HAVE_MESSAGES MHD_DLOG (daemon, _ ("Listen socket descriptor (%d) is not " \ - "less than FD_SETSIZE (%d).\n"), + "less than FD_SETSIZE (%d).\n"), (int) listen_fd, (int) FD_SETSIZE); #endif @@ -7264,6 +7265,12 @@ MHD_stop_daemon (struct MHD_Daemon *daemon) /* No internal threads are used for polling sockets. */ close_all_connections (daemon); } + mhd_assert (NULL == daemon->connections_head); + mhd_assert (NULL == daemon->cleanup_head); + mhd_assert (NULL == daemon->suspended_connections_head); + mhd_assert (NULL == daemon->new_connections_head); + mhd_assert (NULL == daemon->urh_head); + if (MHD_ITC_IS_VALID_ (daemon->itc)) MHD_itc_destroy_chk_ (daemon->itc); MHD_mutex_destroy_chk_ (&daemon->new_connections_mutex);