gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [libmicrohttpd] branch master updated (96aabc14 -> 875e27c5


From: gnunet
Subject: [GNUnet-SVN] [libmicrohttpd] branch master updated (96aabc14 -> 875e27c5)
Date: Wed, 15 Mar 2017 21:37:40 +0100

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

karlson2k pushed a change to branch master
in repository libmicrohttpd.

    from 96aabc14 MHD_connection_handle_idle(): fixed reset of 
'connection->in_idle' to false
     new 0934cb43 MHD_connection_handle_idle(): one more missing reset of 
'connection->in_idle'
     new 68100085 MHD_connection_handle_idle(): better handle suspended 
connections, prevent suspended connection closure by timeout.
     new 875e27c5 MHD_run_from_select(): removed ability to run epoll fd_sets 
don not provide any useful information for epoll, so MHD_run() should be used 
for epoll-based daemons.

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 ChangeLog                   |  7 +++++++
 src/microhttpd/connection.c | 31 +++++++++++++++----------------
 src/microhttpd/daemon.c     | 13 +------------
 3 files changed, 23 insertions(+), 28 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 11cc8221..fa4e0f28 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Wed Mar 15 23:29:59 MSK 2017
+       Prevented socket read/write if connection is suspended.
+       Added missing resets of 'connection->in_idle'.
+       Reworked handling of suspended connection: ensure that
+       connection is not disconnected by timeout, always
+       updated read/write states right after suspending. -EG
+
 Wed Mar 15 21:02:26 MSK 2017
        Added new enum value MHD_CONNECTION_INFO_CONNECTION_TIMEOUT
        to get connection timeout by MHD_get_connection_info(). -EG
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index f85ab21b..8e348f25 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -2732,7 +2732,6 @@ int
 MHD_connection_handle_idle (struct MHD_Connection *connection)
 {
   struct MHD_Daemon *daemon = connection->daemon;
-  unsigned int timeout;
   const char *end;
   char *line;
   size_t line_len;
@@ -2740,13 +2739,8 @@ MHD_connection_handle_idle (struct MHD_Connection 
*connection)
   int ret;
 
   connection->in_idle = true;
-  while (1)
+  while (! connection->suspended)
     {
-      if (connection->suspended)
-        {
-          connection->in_idle = false;
-          return MHD_YES;
-        }
 #if DEBUG_STATES
       MHD_DLOG (daemon,
                 _("In function %s handling connection at state: %s\n"),
@@ -3201,6 +3195,7 @@ MHD_connection_handle_idle (struct MHD_Connection 
*connection)
          return MHD_NO;
 #ifdef UPGRADE_SUPPORT
        case MHD_CONNECTION_UPGRADE:
+          connection->in_idle = false;
           return MHD_YES; /* keep open */
 #endif /* UPGRADE_SUPPORT */
        default:
@@ -3209,19 +3204,24 @@ MHD_connection_handle_idle (struct MHD_Connection 
*connection)
         }
       break;
     }
-  timeout = connection->connection_timeout;
-  if ( (0 != timeout) &&
-       (timeout <= (MHD_monotonic_sec_counter() - connection->last_activity)) )
+  if (! connection->suspended)
     {
-      MHD_connection_close_ (connection,
-                             MHD_REQUEST_TERMINATED_TIMEOUT_REACHED);
-      connection->in_idle = false;
-      return MHD_YES;
+      unsigned int timeout;
+      timeout = connection->connection_timeout;
+      if ( (0 != timeout) &&
+           (timeout <= (MHD_monotonic_sec_counter() - 
connection->last_activity)) )
+        {
+          MHD_connection_close_ (connection,
+                                 MHD_REQUEST_TERMINATED_TIMEOUT_REACHED);
+          connection->in_idle = false;
+          return MHD_YES;
+        }
     }
   MHD_connection_update_event_loop_info (connection);
   ret = MHD_YES;
 #ifdef EPOLL_SUPPORT
-  if (0 != (daemon->options & MHD_USE_EPOLL))
+  if ( (! connection->suspended) &&
+       (0 != (daemon->options & MHD_USE_EPOLL))
     {
       ret = MHD_connection_epoll_update_ (connection);
     }
@@ -3276,7 +3276,6 @@ MHD_connection_epoll_update_ (struct MHD_Connection 
*connection)
        }
       connection->epoll_state |= MHD_EPOLL_STATE_IN_EPOLL_SET;
     }
-  connection->in_idle = false;
   return MHD_YES;
 }
 #endif
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index 84d9afe3..b78aabb0 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -3436,7 +3436,7 @@ MHD_run_from_select (struct MHD_Daemon *daemon,
 {
   fd_set es;
   if (0 != (daemon->options &
-        (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_POLL)) )
+        (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_POLL | MHD_USE_EPOLL)) )
     return MHD_NO;
   if (NULL == read_fd_set || NULL == write_fd_set)
     return MHD_NO;
@@ -3450,17 +3450,6 @@ MHD_run_from_select (struct MHD_Daemon *daemon,
       FD_ZERO (&es);
       except_fd_set = &es;
     }
-  if (0 != (daemon->options & MHD_USE_EPOLL))
-    {
-#ifdef EPOLL_SUPPORT
-      int ret;
-      ret = MHD_epoll (daemon, MHD_NO);
-      MHD_cleanup_connections (daemon);
-      return ret;
-#else  /* ! EPOLL_SUPPORT */
-      return MHD_NO;
-#endif /* ! EPOLL_SUPPORT */
-    }
   return internal_run_from_select (daemon, read_fd_set,
                                    write_fd_set, except_fd_set);
 }

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



reply via email to

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