gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r15738 - libmicrohttpd/src/daemon
Date: Wed, 22 Jun 2011 10:25:00 +0200

Author: grothoff
Date: 2011-06-22 10:25:00 +0200 (Wed, 22 Jun 2011)
New Revision: 15738

Modified:
   libmicrohttpd/src/daemon/connection.c
   libmicrohttpd/src/daemon/daemon.c
Log:
only call MHD_get_timeout if not in thread-per-connection mode

Modified: libmicrohttpd/src/daemon/connection.c
===================================================================
--- libmicrohttpd/src/daemon/connection.c       2011-06-22 08:08:07 UTC (rev 
15737)
+++ libmicrohttpd/src/daemon/connection.c       2011-06-22 08:25:00 UTC (rev 
15738)
@@ -888,7 +888,7 @@
           if (MHD_YES == connection->read_closed)
             {
              CONNECTION_CLOSE_ERROR (connection, 
-                                     "Connection closed while reading 
request\n");
+                                     NULL);
               continue;
             }
           p->events |= MHD_POLL_ACTION_IN;
@@ -1954,7 +1954,7 @@
               if (connection->read_closed)
                 {
                  CONNECTION_CLOSE_ERROR (connection, 
-                                         "Connection closed while reading 
request\n");
+                                         NULL);
                   continue;
                 }
               break;
@@ -1973,7 +1973,7 @@
               if (connection->read_closed)
                 {
                  CONNECTION_CLOSE_ERROR (connection, 
-                                         "Connection closed while reading 
request\n");
+                                         NULL);
                   continue;
                 }
               break;
@@ -2001,7 +2001,7 @@
               if (connection->read_closed)
                 {
                  CONNECTION_CLOSE_ERROR (connection, 
-                                         "Connection closed while reading 
request\n");
+                                         NULL);
                   continue;
                 }
               break;
@@ -2077,7 +2077,7 @@
               if (connection->read_closed)
                 {
                  CONNECTION_CLOSE_ERROR (connection, 
-                                         "Connection closed while reading 
request\n");
+                                         NULL);
                   continue;
                 }
               break;
@@ -2105,7 +2105,7 @@
               if (connection->read_closed)
                 {
                  CONNECTION_CLOSE_ERROR (connection, 
-                                         "Connection closed while reading 
request\n");
+                                         NULL);
                   continue;
                 }
               break;

Modified: libmicrohttpd/src/daemon/daemon.c
===================================================================
--- libmicrohttpd/src/daemon/daemon.c   2011-06-22 08:08:07 UTC (rev 15737)
+++ libmicrohttpd/src/daemon/daemon.c   2011-06-22 08:25:00 UTC (rev 15738)
@@ -1248,6 +1248,13 @@
   struct MHD_Connection *pos;
   unsigned int dto;
 
+  if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION))
+    {
+#if HAVE_MESSAGES
+      MHD_DLOG (daemon, "Illegal call to MHD_get_timeout\n");
+#endif  
+      return MHD_NO;
+    }
   dto = daemon->connection_timeout;
   if (0 == dto)
     return MHD_NO;
@@ -1334,7 +1341,8 @@
       timeout.tv_sec = 0;
       tv = &timeout;
     }
-  else if (MHD_YES == MHD_get_timeout (daemon, &ltimeout))
+  else if ( (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) &&
+           (MHD_YES == MHD_get_timeout (daemon, &ltimeout)) )
     {
       /* ltimeout is in ms */
       timeout.tv_usec = (ltimeout % 1000) * 1000;
@@ -1429,7 +1437,8 @@
       }
     if (may_block == MHD_NO)
       timeout = 0;
-    else if (MHD_YES != MHD_get_timeout (daemon, &ltimeout))
+    else if ( (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) ||
+             (MHD_YES != MHD_get_timeout (daemon, &ltimeout)) )
       timeout = -1;
     else
       timeout = (ltimeout > INT_MAX) ? INT_MAX : (int) ltimeout;
@@ -1502,7 +1511,6 @@
                        int may_block)
 {
   struct pollfd p;
-  unsigned MHD_LONG_LONG ltimeout;
   int timeout;
   
   memset (&p, 0, sizeof (p));
@@ -1511,10 +1519,8 @@
   p.revents = 0;
   if (may_block == MHD_NO)
     timeout = 0;
-  else if (MHD_YES != MHD_get_timeout (daemon, &ltimeout))
+  else
     timeout = -1;
-  else
-    timeout = (ltimeout > INT_MAX) ? INT_MAX : (int) ltimeout;
 #ifdef __CYGWIN__
   /* See https://gnunet.org/bugs/view.php?id=1674 */
   timeout = ( (timeout > 2000) || (timeout < 0) ) ? 2000 : timeout;
@@ -1582,9 +1588,13 @@
       || (0 != (daemon->options & MHD_USE_SELECT_INTERNALLY)))
     return MHD_NO;
   if ((daemon->options & MHD_USE_POLL) == 0) 
-    MHD_select (daemon, MHD_NO);
+    {
+      MHD_select (daemon, MHD_NO);
+    }
   else
-    MHD_poll (daemon, MHD_NO);
+    {
+      MHD_poll (daemon, MHD_NO);
+    }
   MHD_cleanup_connections (daemon);
   return MHD_YES;
 }




reply via email to

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