commit 94c16f349dac04636da8fe94277d53c344e958c5
parent 316f6c4ef30ef00d7d0692055724fb293f1eb799
Author: Christian Grothoff <christian@grothoff.org>
Date: Tue, 22 Sep 2015 17:21:33 +0000
help systemd by not calling shutdown() on listen socket if MHD_USE_PIPE_FOR_SHUTDOWN is given
Diffstat:
4 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -1,3 +1,7 @@
+Tue Sep 22 19:17:54 CEST 2015
+ Do not use shutdown() on listen socket if MHD_USE_PIPE_FOR_SHUTDOWN
+ is set. -CG
+
Wed Sep 16 11:06:02 CEST 2015
Releasing libmicrohttpd 0.9.43. -CG
diff --git a/doc/libmicrohttpd.texi b/doc/libmicrohttpd.texi
@@ -542,6 +542,10 @@ use of this option is automatic (as in, you do not even have to
specify it), if @code{MHD_USE_NO_LISTEN_SOCKET} is specified. In
"external" select mode, this option is always simply ignored.
+Using this option also guarantees that MHD will not call
+@code{shutdown()} on the listen socket, which means a parent
+process can continue to use the socket.
+
@item MHD_USE_SUSPEND_RESUME
Enables using @code{MHD_suspend_connection} and
@code{MHD_resume_connection}, as performing these calls requires some
diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h
@@ -130,7 +130,7 @@ typedef intptr_t ssize_t;
* Current version of the library.
* 0x01093001 = 1.9.30-1.
*/
-#define MHD_VERSION 0x00094300
+#define MHD_VERSION 0x00094301
/**
* MHD-internal return code for "YES".
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
@@ -2223,7 +2223,7 @@ MHD_run_from_select (struct MHD_Daemon *daemon,
struct MHD_Connection *next;
unsigned int mask = MHD_USE_SUSPEND_RESUME | MHD_USE_EPOLL_INTERNALLY_LINUX_ONLY |
MHD_USE_SELECT_INTERNALLY | MHD_USE_POLL_INTERNALLY | MHD_USE_THREAD_PER_CONNECTION;
-
+
/* Resuming external connections when using an extern mainloop */
if (MHD_USE_SUSPEND_RESUME == (daemon->options & mask))
resume_suspended_connections (daemon);
@@ -4500,7 +4500,8 @@ MHD_stop_daemon (struct MHD_Daemon *daemon)
else
{
/* fd might be MHD_INVALID_SOCKET here due to 'MHD_quiesce_daemon' */
- if (MHD_INVALID_SOCKET != fd)
+ if ( (MHD_INVALID_SOCKET != fd) &&
+ (0 == (daemon->options & MHD_USE_PIPE_FOR_SHUTDOWN)) )
(void) shutdown (fd, SHUT_RDWR);
}
#endif