gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r37066 - in libmicrohttpd: . src/microhttpd


From: gnunet
Subject: [GNUnet-SVN] r37066 - in libmicrohttpd: . src/microhttpd
Date: Sat, 23 Apr 2016 18:15:58 +0200

Author: Karlson2k
Date: 2016-04-23 18:15:58 +0200 (Sat, 23 Apr 2016)
New Revision: 37066

Modified:
   libmicrohttpd/ChangeLog
   libmicrohttpd/src/microhttpd/daemon.c
Log:
MHD_quiesce_daemon(): notify other threads so listen socket FD
is removed from awaiting select() and poll().

Modified: libmicrohttpd/ChangeLog
===================================================================
--- libmicrohttpd/ChangeLog     2016-04-23 16:15:55 UTC (rev 37065)
+++ libmicrohttpd/ChangeLog     2016-04-23 16:15:58 UTC (rev 37066)
@@ -1,3 +1,7 @@
+Sat Apr 23 15:39:38 CET 2016
+       Notify other threads in MHD_quiesce_daemon() so listen socket FD
+       is removed from awaiting select() and poll(). -EG
+
 Sat Apr 23 14:17:15 CET 2016
        Revert "shutdown trigger select" on Darwin. Fixed daemon shutdown
        on Darwin without "MHD_USE_PIPE_FOR_SHUTDOWN" option. -EG

Modified: libmicrohttpd/src/microhttpd/daemon.c
===================================================================
--- libmicrohttpd/src/microhttpd/daemon.c       2016-04-23 16:15:55 UTC (rev 
37065)
+++ libmicrohttpd/src/microhttpd/daemon.c       2016-04-23 16:15:58 UTC (rev 
37066)
@@ -3105,9 +3105,9 @@
  * clients to continue processing, but stops accepting new
  * connections.  Note that the caller is responsible for closing the
  * returned socket; however, if MHD is run using threads (anything but
- * external select mode), it must not be closed until AFTER
- * #MHD_stop_daemon has been called (as it is theoretically possible
- * that an existing thread is still using it).
+ * external select mode), socket will be removed from existing threads
+ * with some delay and it must not be closed while it's in use. To make
+ * sure that socket is not used anymore, call #MHD_stop_daemon.
  *
  * Note that some thread modes require the caller to have passed
  * #MHD_USE_PIPE_FOR_SHUTDOWN when using this API.  If this daemon is
@@ -3154,7 +3154,13 @@
              MHD_PANIC ("Failed to remove listen FD from epoll set\n");
            daemon->worker_pool[i].listen_socket_in_epoll = MHD_NO;
          }
+        else
 #endif
+        if (MHD_INVALID_PIPE_ != daemon->worker_pool[i].wpipe[1])
+          {
+            if (1 != MHD_pipe_write_ (daemon->worker_pool[i].wpipe[1], "q", 1))
+              MHD_PANIC ("failed to signal quiesce via pipe");
+          }
       }
   daemon->socket_fd = MHD_INVALID_SOCKET;
 #if EPOLL_SUPPORT
@@ -3169,7 +3175,14 @@
        MHD_PANIC ("Failed to remove listen FD from epoll set\n");
       daemon->listen_socket_in_epoll = MHD_NO;
     }
+  else
 #endif
+  if (MHD_INVALID_PIPE_ != daemon->wpipe[1])
+    {
+      if (1 != MHD_pipe_write_ (daemon->wpipe[1], "q", 1))
+       MHD_PANIC ("failed to signal quiesce via pipe");
+    }
+
   return ret;
 }
 




reply via email to

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