[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [libmicrohttpd] branch master updated: MHD_stop_daemon(): d
From: |
gnunet |
Subject: |
[GNUnet-SVN] [libmicrohttpd] branch master updated: MHD_stop_daemon(): do not shutdown listen socket before setting shutdown flag |
Date: |
Mon, 30 Oct 2017 15:47:20 +0100 |
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 d8a32e84 MHD_stop_daemon(): do not shutdown listen socket before
setting shutdown flag
d8a32e84 is described below
commit d8a32e84af6ad081fb7d6e31b1fc2fe0ffcbc86d
Author: Evgeny Grin (Karlson2k) <address@hidden>
AuthorDate: Mon Oct 30 16:13:39 2017 +0300
MHD_stop_daemon(): do not shutdown listen socket before setting shutdown
flag
---
src/microhttpd/daemon.c | 28 ++++++++++++++++++++--------
1 file changed, 20 insertions(+), 8 deletions(-)
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index 7b651259..918ef4ad 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -6239,12 +6239,6 @@ MHD_stop_daemon (struct MHD_Daemon *daemon)
else
fd = daemon->listen_fd;
- if (MHD_INVALID_SOCKET != fd)
- {
- (void) shutdown (fd,
- SHUT_RDWR);
- }
-
if (NULL != daemon->worker_pool)
{ /* Master daemon with worker pool. */
mhd_assert (1 < daemon->worker_pool_size);
@@ -6262,6 +6256,13 @@ MHD_stop_daemon (struct MHD_Daemon *daemon)
else
mhd_assert (MHD_INVALID_SOCKET != fd);
}
+#ifdef HAVE_LISTEN_SHUTDOWN
+ if (MHD_INVALID_SOCKET != fd)
+ {
+ (void) shutdown (fd,
+ SHUT_RDWR);
+ }
+#endif /* HAVE_LISTEN_SHUTDOWN */
for (i = 0; i < daemon->worker_pool_size; ++i)
{
MHD_stop_daemon (&daemon->worker_pool[i]);
@@ -6292,7 +6293,18 @@ MHD_stop_daemon (struct MHD_Daemon *daemon)
MHD_PANIC (_("Failed to signal shutdown via inter-thread
communication channel"));
}
else
- mhd_assert (MHD_INVALID_SOCKET != fd);
+ {
+#ifdef HAVE_LISTEN_SHUTDOWN
+ if (MHD_INVALID_SOCKET != fd)
+ {
+ if (NULL == daemon->master)
+ (void) shutdown (fd,
+ SHUT_RDWR);
+ }
+ else
+#endif /* HAVE_LISTEN_SHUTDOWN */
+ mhd_assert (false); /* Should never happen */
+ }
if (! MHD_join_thread_ (daemon->pid.handle))
{
@@ -6303,7 +6315,7 @@ MHD_stop_daemon (struct MHD_Daemon *daemon)
}
else
{
- /* Internal threads are not used polling sockets. */
+ /* No internal threads are used for polling sockets. */
close_all_connections (daemon);
}
if (MHD_ITC_IS_VALID_ (daemon->itc))
--
To stop receiving notification emails like this one, please contact
address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] [libmicrohttpd] branch master updated: MHD_stop_daemon(): do not shutdown listen socket before setting shutdown flag,
gnunet <=