gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r8350 - libmicrohttpd/src/daemon


From: gnunet
Subject: [GNUnet-SVN] r8350 - libmicrohttpd/src/daemon
Date: Fri, 27 Mar 2009 14:36:21 -0600

Author: holindho
Date: 2009-03-27 14:36:20 -0600 (Fri, 27 Mar 2009)
New Revision: 8350

Modified:
   libmicrohttpd/src/daemon/daemon.c
Log:
better fix for OS X stop_daemon issue


Modified: libmicrohttpd/src/daemon/daemon.c
===================================================================
--- libmicrohttpd/src/daemon/daemon.c   2009-03-26 15:41:45 UTC (rev 8349)
+++ libmicrohttpd/src/daemon/daemon.c   2009-03-27 20:36:20 UTC (rev 8350)
@@ -1423,6 +1423,20 @@
       daemon->worker_pool[i].socket_fd = -1;
     }
 
+#if OSX
+  /* without this, either (thread pool = 0) threads would get stuck or
+   * CLOSE would get stuck if attempted before (thread pool > 0) 
+   * threads have ended */
+  SHUTDOWN (fd, SHUT_RDWR);
+#else
+#if DEBUG_CLOSE
+#if HAVE_MESSAGES
+  MHD_DLOG (daemon, "MHD shutdown, closing listen socket\n");
+#endif
+#endif
+  CLOSE (fd);
+#endif
+
   /* 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);
@@ -1437,26 +1451,19 @@
       ((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 OSX
 #if DEBUG_CLOSE
 #if HAVE_MESSAGES
-      MHD_DLOG (daemon, "MHD shutdown, closing listen socket\n");
+  MHD_DLOG (daemon, "MHD shutdown, closing listen socket\n");
 #endif
 #endif
-      CLOSE (fd);
-    }
+  CLOSE (fd);
+#endif
 
   /* TLS clean up */
 #if HTTPS_SUPPORT





reply via email to

[Prev in Thread] Current Thread [Next in Thread]