aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-09-21 07:58:16 +0000
committerChristian Grothoff <christian@grothoff.org>2011-09-21 07:58:16 +0000
commitc36962f2c19a8d97f4faa0446b93984a75842c8e (patch)
tree21b5eccb4a300d38bb822974fd32a3a099e55142
parent41be6325c89377b9a2d9aff1493c3d4fb62e0fb4 (diff)
downloadlibmicrohttpd-c36962f2c19a8d97f4faa0446b93984a75842c8e.tar.gz
libmicrohttpd-c36962f2c19a8d97f4faa0446b93984a75842c8e.zip
fix
-rw-r--r--ChangeLog4
-rw-r--r--configure.ac6
-rw-r--r--src/daemon/daemon.c11
3 files changed, 17 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 12b112c0..ac0e4978 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
1Wed Sep 21 09:53:18 CEST 2011
2 Reverting to using pipes for signalling select on non-Linux
3 platforms where shutdown-on-listen-sockets does not work. -WB/CG
4
1Mon Sep 19 14:06:30 CEST 2011 5Mon Sep 19 14:06:30 CEST 2011
2 Fixing problem introduced with prompt response cleanup code. -CG 6 Fixing problem introduced with prompt response cleanup code. -CG
3 7
diff --git a/configure.ac b/configure.ac
index b2d435aa..34686ca5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -85,6 +85,7 @@ case "$host_os" in
85 ;; 85 ;;
86linux*) 86linux*)
87 AC_DEFINE_UNQUOTED(LINUX,1,[This is a Linux system]) 87 AC_DEFINE_UNQUOTED(LINUX,1,[This is a Linux system])
88 AC_DEFINE_UNQUOTED(HAVE_LISTEN_SHUTDOWN,1,[can use shutdown on listen sockets])
88 AM_CONDITIONAL(HAVE_GNU_LD, true) 89 AM_CONDITIONAL(HAVE_GNU_LD, true)
89 AM_CONDITIONAL(HAVE_W32, false) 90 AM_CONDITIONAL(HAVE_W32, false)
90 ;; 91 ;;
@@ -116,6 +117,7 @@ netbsd*)
116 ;; 117 ;;
117*arm-linux*) 118*arm-linux*)
118 AC_DEFINE_UNQUOTED(LINUX,1,[This is a Linux system]) 119 AC_DEFINE_UNQUOTED(LINUX,1,[This is a Linux system])
120 AC_DEFINE_UNQUOTED(HAVE_LISTEN_SHUTDOWN,1,[can use shutdown on listen sockets])
119 CFLAGS="-D_REENTRANT -fPIC -pipe $CFLAGS" 121 CFLAGS="-D_REENTRANT -fPIC -pipe $CFLAGS"
120 AM_CONDITIONAL(HAVE_GNU_LD, true) 122 AM_CONDITIONAL(HAVE_GNU_LD, true)
121 AM_CONDITIONAL(HAVE_W32, false) 123 AM_CONDITIONAL(HAVE_W32, false)
@@ -147,6 +149,10 @@ netbsd*)
147*) 149*)
148 AC_MSG_RESULT(Unrecognised OS $host_os) 150 AC_MSG_RESULT(Unrecognised OS $host_os)
149 AC_DEFINE_UNQUOTED(OTHEROS,1,[Some strange OS]) 151 AC_DEFINE_UNQUOTED(OTHEROS,1,[Some strange OS])
152# You might want to find out if your OS supports shutdown on listen sockets,
153# and extend the switch statement; if we do not have 'HAVE_LISTEN_SHUTDOWN',
154# pipes are used instead to signal 'select'.
155# AC_DEFINE_UNQUOTED(HAVE_LISTEN_SHUTDOWN,1,[can use shutdown on listen sockets])
150 AM_CONDITIONAL(HAVE_GNU_LD, false) 156 AM_CONDITIONAL(HAVE_GNU_LD, false)
151 AM_CONDITIONAL(HAVE_W32, false) 157 AM_CONDITIONAL(HAVE_W32, false)
152;; 158;;
diff --git a/src/daemon/daemon.c b/src/daemon/daemon.c
index aedbf76c..632db289 100644
--- a/src/daemon/daemon.c
+++ b/src/daemon/daemon.c
@@ -2517,23 +2517,24 @@ MHD_stop_daemon (struct MHD_Daemon *daemon)
2517 int fd; 2517 int fd;
2518 unsigned int i; 2518 unsigned int i;
2519 int rc; 2519 int rc;
2520 char c;
2521 2520
2522 if (daemon == NULL) 2521 if (daemon == NULL)
2523 return; 2522 return;
2524 daemon->shutdown = MHD_YES; 2523 daemon->shutdown = MHD_YES;
2525 fd = daemon->socket_fd; 2524 fd = daemon->socket_fd;
2526 daemon->socket_fd = -1; 2525 daemon->socket_fd = -1;
2527 if (daemon->wpipe[1] != -1)
2528 write (daemon->wpipe[1], "e", 1);
2529
2530 /* Prepare workers for shutdown */ 2526 /* Prepare workers for shutdown */
2531 for (i = 0; i < daemon->worker_pool_size; ++i) 2527 for (i = 0; i < daemon->worker_pool_size; ++i)
2532 { 2528 {
2533 daemon->worker_pool[i].shutdown = MHD_YES; 2529 daemon->worker_pool[i].shutdown = MHD_YES;
2534 daemon->worker_pool[i].socket_fd = -1; 2530 daemon->worker_pool[i].socket_fd = -1;
2535 } 2531 }
2532#ifdef HAVE_LISTEN_SHUTDOWN
2536 SHUTDOWN (fd, SHUT_RDWR); 2533 SHUTDOWN (fd, SHUT_RDWR);
2534#else
2535 if (daemon->wpipe[1] != -1)
2536 write (daemon->wpipe[1], "e", 1);
2537#endif
2537#if DEBUG_CLOSE 2538#if DEBUG_CLOSE
2538#if HAVE_MESSAGES 2539#if HAVE_MESSAGES
2539 MHD_DLOG (daemon, "MHD listen socket shutdown\n"); 2540 MHD_DLOG (daemon, "MHD listen socket shutdown\n");
@@ -2608,6 +2609,8 @@ MHD_stop_daemon (struct MHD_Daemon *daemon)
2608#ifndef HAVE_LISTEN_SHUTDOWN 2609#ifndef HAVE_LISTEN_SHUTDOWN
2609 if (daemon->wpipe[1] != -1) 2610 if (daemon->wpipe[1] != -1)
2610 { 2611 {
2612 char c;
2613
2611 /* just to be sure, remove the one char we 2614 /* just to be sure, remove the one char we
2612 wrote into the pipe */ 2615 wrote into the pipe */
2613 (void) read (daemon->wpipe[0], &c, 1); 2616 (void) read (daemon->wpipe[0], &c, 1);