gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r35678 - in libmicrohttpd: . src/microhttpd
Date: Thu, 30 Apr 2015 00:05:15 +0200

Author: grothoff
Date: 2015-04-30 00:05:15 +0200 (Thu, 30 Apr 2015)
New Revision: 35678

Modified:
   libmicrohttpd/ChangeLog
   libmicrohttpd/src/microhttpd/daemon.c
Log:
if we actually resumed a connection, the following call to 
select()/poll()/epoll() must always be non-blocking

Modified: libmicrohttpd/ChangeLog
===================================================================
--- libmicrohttpd/ChangeLog     2015-04-29 15:16:04 UTC (rev 35677)
+++ libmicrohttpd/ChangeLog     2015-04-29 22:05:15 UTC (rev 35678)
@@ -1,3 +1,8 @@
+Thu Apr 30 00:02:33 CEST 2015
+       Fix issue where resumed connections would not continue
+       unless other requests are active in certain
+       event-loop modes. Thanks to Mike Castillo for reporting. -CG
+
 Wed Apr 15 03:16:18 CEST 2015
        Fixing issue #3753 (testcase issue). -CG
 

Modified: libmicrohttpd/src/microhttpd/daemon.c
===================================================================
--- libmicrohttpd/src/microhttpd/daemon.c       2015-04-29 15:16:04 UTC (rev 
35677)
+++ libmicrohttpd/src/microhttpd/daemon.c       2015-04-29 22:05:15 UTC (rev 
35678)
@@ -1726,17 +1726,19 @@
  * longer suspended back to the active state.
  *
  * @param daemon daemon context
+ * @return #MHD_YES if a connection was actually resumed
  */
-static void
+static int
 resume_suspended_connections (struct MHD_Daemon *daemon)
 {
   struct MHD_Connection *pos;
   struct MHD_Connection *next = NULL;
+  int ret;
 
+  ret = MHD_NO;
   if ( (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) &&
        (MHD_YES != MHD_mutex_lock_ (&daemon->cleanup_connection_mutex)) )
     MHD_PANIC ("Failed to acquire cleanup mutex\n");
-
   if (MHD_YES == daemon->resuming)
     next = daemon->suspended_connections_head;
 
@@ -1745,7 +1747,7 @@
       next = pos->next;
       if (MHD_NO == pos->resuming)
         continue;
-
+      ret = MHD_YES;
       DLL_remove (daemon->suspended_connections_head,
                   daemon->suspended_connections_tail,
                   pos);
@@ -1781,6 +1783,7 @@
   if ( (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) &&
        (MHD_YES != MHD_mutex_unlock_ (&daemon->cleanup_connection_mutex)) )
     MHD_PANIC ("Failed to release cleanup mutex\n");
+  return ret;
 }
 
 
@@ -2268,8 +2271,9 @@
   max = MHD_INVALID_SOCKET;
   if (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION))
     {
-      if (MHD_USE_SUSPEND_RESUME == (daemon->options & MHD_USE_SUSPEND_RESUME))
-        resume_suspended_connections (daemon);
+      if ( (MHD_USE_SUSPEND_RESUME == (daemon->options & 
MHD_USE_SUSPEND_RESUME)) &&
+           (MHD_YES == resume_suspended_connections (daemon)) )
+        may_block = MHD_NO;
 
       /* single-threaded, go over everything */
       if (MHD_NO == MHD_get_fdset2 (daemon, &rs, &ws, &es, &max, FD_SETSIZE))
@@ -2354,8 +2358,9 @@
   struct MHD_Connection *pos;
   struct MHD_Connection *next;
 
-  if (MHD_USE_SUSPEND_RESUME == (daemon->options & MHD_USE_SUSPEND_RESUME))
-    resume_suspended_connections (daemon);
+  if ( (MHD_USE_SUSPEND_RESUME == (daemon->options & MHD_USE_SUSPEND_RESUME)) 
&&
+       (MHD_YES == resume_suspended_connections (daemon)) )
+    may_block = MHD_NO;
 
   /* count number of connections and thus determine poll set size */
   num_connections = 0;
@@ -2750,8 +2755,9 @@
 
   /* we handle resumes here because we may have ready connections
      that will not be placed into the epoll list immediately. */
-  if (MHD_USE_SUSPEND_RESUME == (daemon->options & MHD_USE_SUSPEND_RESUME))
-    resume_suspended_connections (daemon);
+  if ( (MHD_USE_SUSPEND_RESUME == (daemon->options & MHD_USE_SUSPEND_RESUME)) 
&&
+       (MHD_YES == resume_suspended_connections (daemon)) )
+    may_block = MHD_NO;
 
   /* process events for connections */
   while (NULL != (pos = daemon->eready_tail))




reply via email to

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