gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [libmicrohttpd] branch master updated: Fixed processing epo


From: gnunet
Subject: [GNUnet-SVN] [libmicrohttpd] branch master updated: Fixed processing epoll with many connections to accept. If 'accept_pending' were set to 'true' not connection transfer occurred. Additionally 'accept_pending' never reset to false.
Date: Sat, 21 Jan 2017 19:42:30 +0100

This is an automated email from the git hooks/post-receive script.

karlson2k pushed a commit to branch master
in repository libmicrohttpd.

The following commit(s) were added to refs/heads/master by this push:
     new 313e750c Fixed processing epoll with many connections to accept. If 
'accept_pending' were set to 'true' not connection transfer occurred. 
Additionally 'accept_pending' never reset to false.
313e750c is described below

commit 313e750c65cecfce85c1eed4f73c71196fecbac8
Author: Evgeny Grin (Karlson2k) <address@hidden>
AuthorDate: Sat Jan 21 21:42:05 2017 +0300

    Fixed processing epoll with many connections to accept.
    If 'accept_pending' were set to 'true' not connection transfer occurred.
    Additionally 'accept_pending' never reset to false.
---
 src/microhttpd/daemon.c   | 31 +++++++++++--------------------
 src/microhttpd/internal.h |  7 -------
 2 files changed, 11 insertions(+), 27 deletions(-)

diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index 5a314578..5ae6f138 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -3691,7 +3691,6 @@ MHD_epoll (struct MHD_Daemon *daemon,
   MHD_UNSIGNED_LONG_LONG timeout_ll;
   int num_events;
   unsigned int i;
-  unsigned int series_length;
 #if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT)
   int run_upgraded = MHD_NO;
 #endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */
@@ -3830,26 +3829,18 @@ MHD_epoll (struct MHD_Daemon *daemon,
               MHD_itc_clear_ (daemon->itc);
               continue;
             }
-         if ( (daemon == events[i].data.ptr) ||
-               (daemon->accept_pending) )
+         if (daemon == events[i].data.ptr)
            {
-             /* run 'accept' until it fails or we are not allowed to take
-                on more connections */
-             series_length = 0;
-             while (MHD_YES == MHD_accept_connection (daemon))
-              {
-                if ( (daemon->connections < daemon->connection_limit) &&
-                     (series_length < 128) &&
-                     (! daemon->at_limit) )
-                  series_length++;
-                else
-                {
-                  /* Use the 'accept_pending' flag to remember that we stopped
-                     for resource limits, not because we drained accept() */
-                  daemon->accept_pending = true;
-                  break;
-                }
-              }
+             unsigned int series_length = 0;
+              /* Run 'accept' until it fails or daemon at limit of connections.
+               * Do not accept more then 10 connections at once. The rest will
+               * be accepted on next turn (level trigger is used for listen
+               * socket). */
+             while ( (MHD_YES == MHD_accept_connection (daemon)) &&
+                      (series_length < 10) &&
+                      (daemon->connections < daemon->connection_limit) &&
+                      (! daemon->at_limit) )
+                series_length++;
               continue;
            }
           /* this is an event relating to a 'normal' connection,
diff --git a/src/microhttpd/internal.h b/src/microhttpd/internal.h
index 8f6e09f8..c9d21aa4 100644
--- a/src/microhttpd/internal.h
+++ b/src/microhttpd/internal.h
@@ -1405,13 +1405,6 @@ struct MHD_Daemon
    */
   int listen_socket_in_epoll;
 
-  /**
-   * true if we have more incoming connections to be accepted from
-   * the last event-loop iteration (and might not be triggered for
-   * those explicitly anymore), false if we drained the queue.
-   */
-  bool accept_pending;
-
 #if defined(HTTPS_SUPPORT) && defined(UPGRADE_SUPPORT)
   /**
    * File descriptor associated with the #run_epoll_for_upgrade() loop.

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

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