gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r34406 - in libmicrohttpd: . src/microhttpd
Date: Tue, 18 Nov 2014 13:54:01 +0100

Author: grothoff
Date: 2014-11-18 13:54:01 +0100 (Tue, 18 Nov 2014)
New Revision: 34406

Modified:
   libmicrohttpd/ChangeLog
   libmicrohttpd/src/microhttpd/daemon.c
Log:
Hi Christian,

the recently added MHD_DAEMON_INFO_CURRENT_CONNECTIONS can return quite
outdated values in MHD_USE_THREAD_PER_CONNECTION mode. The reason is
that closed connections are collected in MHD_cleanup_connections, which
is called only from the select thread. In the
MHD_USE_THREAD_PER_CONNECTION mode that happens only after accepting an
connection -- therefore, the last connection is always not collected and
MHD_DAEMON_INFO_CURRENT_CONNECTIONS returns >= 1, even when there are no
connections. That makes it very unusable to detect whether all
connections have been handled.

Would you consider the attached patch, which calls
MHD_cleanup_connections whenever MHD_DAEMON_INFO_CURRENT_CONNECTIONS is
called? It makes MHD_DAEMON_INFO_CURRENT_CONNECTIONS slower, but the
returned value is much more accurate.

Cheers,
Milan Straka



Modified: libmicrohttpd/ChangeLog
===================================================================
--- libmicrohttpd/ChangeLog     2014-11-15 19:06:41 UTC (rev 34405)
+++ libmicrohttpd/ChangeLog     2014-11-18 12:54:01 UTC (rev 34406)
@@ -1,3 +1,7 @@
+Tue Nov 18 13:52:29 CET 2014
+       Call MHD_cleanup_connections() during 
MHD_DAEMON_INFO_CURRENT_CONNECTIONS
+       processing for more accurate results. -MS
+
 Wed Oct 29 20:45:21 CET 2014
        Adding MHD_OPTION_LISTENING_ADDRESS_REUSE option allowing clients
        to force allowing re-use of the address:port combination

Modified: libmicrohttpd/src/microhttpd/daemon.c
===================================================================
--- libmicrohttpd/src/microhttpd/daemon.c       2014-11-15 19:06:41 UTC (rev 
34405)
+++ libmicrohttpd/src/microhttpd/daemon.c       2014-11-18 12:54:01 UTC (rev 
34406)
@@ -4344,6 +4344,7 @@
       return (const union MHD_DaemonInfo *) &daemon->epoll_fd;
 #endif
     case MHD_DAEMON_INFO_CURRENT_CONNECTIONS:
+      MHD_cleanup_connections (daemon);
       if (daemon->worker_pool)
         {
           /* Collect the connection information stored in the workers. */
@@ -4351,7 +4352,10 @@
 
           daemon->connections = 0;
           for (i=0;i<daemon->worker_pool_size;i++)
-            daemon->connections += daemon->worker_pool[i].connections;
+            {
+              MHD_cleanup_connections (&daemon->worker_pool[i]);
+              daemon->connections += daemon->worker_pool[i].connections;
+            }
         }
       return (const union MHD_DaemonInfo *) &daemon->connections;
     default:




reply via email to

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