[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r8347 - libmicrohttpd/src/daemon
From: |
gnunet |
Subject: |
[GNUnet-SVN] r8347 - libmicrohttpd/src/daemon |
Date: |
Thu, 26 Mar 2009 07:04:50 -0600 |
Author: holindho
Date: 2009-03-26 07:04:49 -0600 (Thu, 26 Mar 2009)
New Revision: 8347
Modified:
libmicrohttpd/src/daemon/daemon.c
Log:
attempt to fix a threading issue on OS X: close() in MHD_stop_daemon will get
stuck if someone's in accept(), but select() in MHD_select may get stuck if
the socket isn't already closed on shutdown.
Modified: libmicrohttpd/src/daemon/daemon.c
===================================================================
--- libmicrohttpd/src/daemon/daemon.c 2009-03-25 20:42:34 UTC (rev 8346)
+++ libmicrohttpd/src/daemon/daemon.c 2009-03-26 13:04:49 UTC (rev 8347)
@@ -1423,13 +1423,6 @@
daemon->worker_pool[i].socket_fd = -1;
}
-#if DEBUG_CLOSE
-#if HAVE_MESSAGES
- MHD_DLOG (daemon, "MHD shutdown, closing listen socket\n");
-#endif
-#endif
- CLOSE (fd);
-
/* Signal workers to stop and clean them up */
for (i = 0; i < daemon->worker_pool_size; ++i)
pthread_kill (daemon->worker_pool[i].pid, SIGALRM);
@@ -1444,11 +1437,27 @@
((0 != (daemon->options & MHD_USE_SELECT_INTERNALLY))
&& (0 == daemon->worker_pool_size)))
{
+#if DEBUG_CLOSE
+#if HAVE_MESSAGES
+ MHD_DLOG (daemon, "MHD shutdown, closing listen socket\n");
+#endif
+#endif
+ CLOSE (fd);
pthread_kill (daemon->pid, SIGALRM);
pthread_join (daemon->pid, &unused);
}
MHD_close_connections (daemon);
+ if (0 < daemon->worker_pool_size)
+ {
+#if DEBUG_CLOSE
+#if HAVE_MESSAGES
+ MHD_DLOG (daemon, "MHD shutdown, closing listen socket\n");
+#endif
+#endif
+ CLOSE (fd);
+ }
+
/* TLS clean up */
#if HTTPS_SUPPORT
if (daemon->options & MHD_USE_SSL)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r8347 - libmicrohttpd/src/daemon,
gnunet <=