gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [libmicrohttpd] branch master updated (58998332 -> 76500135


From: gnunet
Subject: [GNUnet-SVN] [libmicrohttpd] branch master updated (58998332 -> 76500135)
Date: Thu, 16 Mar 2017 19:49:18 +0100

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

karlson2k pushed a change to branch master
in repository libmicrohttpd.

    from 58998332 run_tls_handshake(): fixed wrong return value resulting in 
slower TLS connection setup
     new 7d4e3953 Unified update of connection activity.
     new 76500135 Update connection last activity if and only if any data was 
received or transmitted.

The 2 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                         |  4 ++++
 src/microhttpd/connection.c       | 20 ++++++++++++--------
 src/microhttpd/connection.h       |  9 +++++++++
 src/microhttpd/connection_https.c |  2 +-
 src/microhttpd/daemon.c           |  5 ++---
 5 files changed, 28 insertions(+), 12 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 882c9598..5b40fb1d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Thu Mar 16 21:05:08 MSK 2017
+       Fixed minor bug resulted in slight slowdown of HTTPS connection
+       handshake. -EG
+
 Thu Mar 16 20:35:59 MSK 2017
        Improved thread-safety for DL-lists. -EG
 
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index 7740e0e7..20bde652 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -2368,8 +2368,8 @@ parse_connection_headers (struct MHD_Connection 
*connection)
  *
  * @param connection the connection that saw some activity
  */
-static void
-update_last_activity (struct MHD_Connection *connection)
+void
+MHD_update_last_activity_ (struct MHD_Connection *connection)
 {
   struct MHD_Daemon *daemon = connection->daemon;
 
@@ -2405,7 +2405,6 @@ update_last_activity (struct MHD_Connection *connection)
 int
 MHD_connection_handle_read (struct MHD_Connection *connection)
 {
-  update_last_activity (connection);
   if ( (MHD_CONNECTION_CLOSED == connection->state) ||
        (connection->suspended) )
     return MHD_YES;
@@ -2416,6 +2415,7 @@ MHD_connection_handle_read (struct MHD_Connection 
*connection)
     try_grow_read_buffer (connection);
   if (MHD_NO == do_read (connection))
     return MHD_YES;
+  MHD_update_last_activity_ (connection);
   while (1)
     {
 #if DEBUG_STATES
@@ -2480,7 +2480,6 @@ MHD_connection_handle_write (struct MHD_Connection 
*connection)
   if (connection->suspended)
     return MHD_YES;
 
-  update_last_activity (connection);
   while (1)
     {
 #if DEBUG_STATES
@@ -2529,6 +2528,7 @@ MHD_connection_handle_write (struct MHD_Connection 
*connection)
                    
&HTTP_100_CONTINUE[connection->continue_message_write_offset]);
 #endif
           connection->continue_message_write_offset += ret;
+          MHD_update_last_activity_ (connection);
           break;
         case MHD_CONNECTION_CONTINUE_SENT:
         case MHD_CONNECTION_BODY_RECEIVED:
@@ -2537,7 +2537,8 @@ MHD_connection_handle_write (struct MHD_Connection 
*connection)
           EXTRA_CHECK (0);
           break;
         case MHD_CONNECTION_HEADERS_SENDING:
-          do_write (connection);
+          if (MHD_NO != do_write (connection))
+            MHD_update_last_activity_ (connection);
          if (MHD_CONNECTION_HEADERS_SENDING != connection->state)
             break;
           check_write_done (connection,
@@ -2569,7 +2570,6 @@ MHD_connection_handle_write (struct MHD_Connection 
*connection)
                                         [(size_t)data_write_offset],
                                         response->data_size -
                                         (size_t)data_write_offset);
-            err = MHD_socket_get_error_ ();
 #if DEBUG_SEND_DATA
             if (ret > 0)
               fprintf (stderr,
@@ -2583,6 +2583,7 @@ MHD_connection_handle_write (struct MHD_Connection 
*connection)
               MHD_mutex_unlock_chk_ (&response->mutex);
             if (ret < 0)
               {
+                err = MHD_socket_get_error_ ();
                 if (MHD_SCKT_ERR_IS_EINTR_ (err) ||
                     MHD_SCKT_ERR_IS_EAGAIN_ (err))
                   return MHD_YES;
@@ -2597,6 +2598,7 @@ MHD_connection_handle_write (struct MHD_Connection 
*connection)
                 return MHD_YES;
               }
             connection->response_write_position += ret;
+            MHD_update_last_activity_ (connection);
           }
           if (connection->response_write_position ==
               connection->response->total_size)
@@ -2606,7 +2608,8 @@ MHD_connection_handle_write (struct MHD_Connection 
*connection)
           EXTRA_CHECK (0);
           break;
         case MHD_CONNECTION_CHUNKED_BODY_READY:
-          do_write (connection);
+          if (MHD_NO != do_write (connection))
+            MHD_update_last_activity_ (connection);
          if (MHD_CONNECTION_CHUNKED_BODY_READY != connection->state)
             break;
           check_write_done (connection,
@@ -2620,7 +2623,8 @@ MHD_connection_handle_write (struct MHD_Connection 
*connection)
           EXTRA_CHECK (0);
           break;
         case MHD_CONNECTION_FOOTERS_SENDING:
-          do_write (connection);
+          if (MHD_NO != do_write (connection))
+            MHD_update_last_activity_ (connection);
          if (MHD_CONNECTION_FOOTERS_SENDING != connection->state)
            break;
           check_write_done (connection,
diff --git a/src/microhttpd/connection.h b/src/microhttpd/connection.h
index ffbc5b80..0bd891d9 100644
--- a/src/microhttpd/connection.h
+++ b/src/microhttpd/connection.h
@@ -134,5 +134,14 @@ int
 MHD_connection_epoll_update_ (struct MHD_Connection *connection);
 #endif
 
+/**
+ * Update the 'last_activity' field of the connection to the current time
+ * and move the connection to the head of the 'normal_timeout' list if
+ * the timeout for the connection uses the default value.
+ *
+ * @param connection the connection that saw some activity
+ */
+void
+update_last_activity (struct MHD_Connection *connection);
 
 #endif
diff --git a/src/microhttpd/connection_https.c 
b/src/microhttpd/connection_https.c
index c4eb835d..5a05bf3b 100644
--- a/src/microhttpd/connection_https.c
+++ b/src/microhttpd/connection_https.c
@@ -48,7 +48,6 @@ run_tls_handshake (struct MHD_Connection *connection)
 {
   int ret;
 
-  connection->last_activity = MHD_monotonic_sec_counter ();
   if (MHD_TLS_CONNECTION_INIT == connection->state)
     {
       ret = gnutls_handshake (connection->tls_session);
@@ -56,6 +55,7 @@ run_tls_handshake (struct MHD_Connection *connection)
        {
          /* set connection state to enable HTTP processing */
          connection->state = MHD_CONNECTION_INIT;
+         MHD_update_last_activity_ (connection);
          return MHD_NO;
        }
       if ( (GNUTLS_E_AGAIN == ret) ||
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index d3b02c27..a93a2ac0 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -1865,10 +1865,9 @@ thread_main_handle_connection (void *data)
           continue; /* Check again for resume. */
         } /* End of "suspended" branch. */
 
-      if ( (was_suspended) &&
-           (0 != con->connection_timeout) )
+      if (was_suspended)
         {
-          con->last_activity = MHD_monotonic_sec_counter(); /* Reset timeout 
timer. */
+          MHD_update_last_activity_ (con); /* Reset timeout timer. */
           was_suspended = false;
         }
 

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



reply via email to

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