[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd] branch master updated: Fixed non-functional daemon with
From: |
gnunet |
Subject: |
[libmicrohttpd] branch master updated: Fixed non-functional daemon with NO_LISTEN and thread pool. MHD failed to start any threads is used with MHD_USE_NO_LISTEN_SOCKET and with thread pool. |
Date: |
Wed, 21 Oct 2020 10:47:43 +0200 |
This is an automated email from the git hooks/post-receive script.
karlson2k pushed a commit to branch master
in repository libmicrohttpd.
The following commit(s) were added to refs/heads/master by this push:
new adcdafc5 Fixed non-functional daemon with NO_LISTEN and thread pool.
MHD failed to start any threads is used with MHD_USE_NO_LISTEN_SOCKET and with
thread pool.
adcdafc5 is described below
commit adcdafc558640b4ef4c22e43c198fe382df33836
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Wed Oct 21 11:35:22 2020 +0300
Fixed non-functional daemon with NO_LISTEN and thread pool.
MHD failed to start any threads is used with MHD_USE_NO_LISTEN_SOCKET and
with thread pool.
---
src/microhttpd/daemon.c | 27 +++++++++++++++++++++++----
1 file changed, 23 insertions(+), 4 deletions(-)
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index 710ba55b..b18885f0 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -6018,7 +6018,7 @@ MHD_start_daemon_va (unsigned int flags,
#ifdef HAVE_LISTEN_SHUTDOWN
if (0 != (*pflags & MHD_USE_NO_LISTEN_SOCKET))
#endif
- *pflags |= MHD_USE_ITC; /* yes, must use ITC to signal thread */
+ *pflags |= MHD_USE_ITC; /* yes, must use ITC to signal thread */
}
#ifdef DAUTH_SUPPORT
daemon->digest_auth_rand_size = 0;
@@ -6594,10 +6594,21 @@ MHD_start_daemon_va (unsigned int flags,
}
#endif /* HTTPS_SUPPORT */
#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
- if ( (0 != (*pflags & MHD_USE_INTERNAL_POLLING_THREAD)) &&
- ( (0 == (*pflags & MHD_USE_NO_LISTEN_SOCKET)) ||
- (MHD_ITC_IS_VALID_ (daemon->itc)) ) )
+ /* Start threads if requested by parameters */
+ if (0 != (*pflags & MHD_USE_INTERNAL_POLLING_THREAD))
{
+ /* Internal thread (or threads) is used.
+ * Make sure that MHD will be able to communicate with threads. */
+ /* If using a thread pool ITC will be initialised later
+ * for each individual worker thread. */
+#ifdef HAVE_LISTEN_SHUTDOWN
+ mhd_assert ((1 < daemon->worker_pool_size) || \
+ (MHD_ITC_IS_VALID_ (daemon->itc)) || \
+ (MHD_INVALID_SOCKET != daemon->listen_fd));
+#else /* ! HAVE_LISTEN_SHUTDOWN */
+ mhd_assert ((1 < daemon->worker_pool_size) || \
+ (MHD_ITC_IS_VALID_ (daemon->itc)));
+#endif /* ! HAVE_LISTEN_SHUTDOWN */
if (0 == daemon->worker_pool_size)
{
if (! MHD_create_named_thread_ (&daemon->pid,
@@ -6630,6 +6641,7 @@ MHD_start_daemon_va (unsigned int flags,
unsigned int leftover_conns = daemon->connection_limit
% daemon->worker_pool_size;
+ mhd_assert (2 <= daemon->worker_pool_size);
i = 0; /* we need this in case fcntl or malloc fails */
/* Allocate memory for pooled objects */
@@ -6680,6 +6692,13 @@ MHD_start_daemon_va (unsigned int flags,
else
MHD_itc_set_invalid_ (d->itc);
+#ifdef HAVE_LISTEN_SHUTDOWN
+ mhd_assert ((MHD_ITC_IS_VALID_ (d->itc)) || \
+ (MHD_INVALID_SOCKET != d->listen_fd));
+#else /* ! HAVE_LISTEN_SHUTDOWN */
+ mhd_assert (MHD_ITC_IS_VALID_ (d->itc));
+#endif /* ! HAVE_LISTEN_SHUTDOWN */
+
/* Divide available connections evenly amongst the threads.
* Thread indexes in [0, leftover_conns) each get one of the
* leftover connections. */
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [libmicrohttpd] branch master updated: Fixed non-functional daemon with NO_LISTEN and thread pool. MHD failed to start any threads is used with MHD_USE_NO_LISTEN_SOCKET and with thread pool.,
gnunet <=