gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [libmicrohttpd] 02/04: Do not update last activity time on


From: gnunet
Subject: [GNUnet-SVN] [libmicrohttpd] 02/04: Do not update last activity time on connections without timeout timer
Date: Thu, 16 Mar 2017 20:44:20 +0100

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

karlson2k pushed a commit to branch master
in repository libmicrohttpd.

commit 396aab2e1190425c9085e697e502522f4e249cff
Author: Evgeny Grin (Karlson2k) <address@hidden>
AuthorDate: Thu Mar 16 22:30:20 2017 +0300

    Do not update last activity time on connections without timeout timer
---
 src/include/microhttpd.h    |  2 ++
 src/microhttpd/connection.c | 11 +++++++++--
 src/microhttpd/connection.h |  2 +-
 3 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h
index 4749a6ee..a09cddf3 100644
--- a/src/include/microhttpd.h
+++ b/src/include/microhttpd.h
@@ -3143,6 +3143,8 @@ enum MHD_CONNECTION_OPTION
    * Set a custom timeout for the given connection.  Specified
    * as the number of seconds, given as an `unsigned int`.  Use
    * zero for no timeout.
+   * If timeout was set to zero (or unset) before, setup of new value by
+   * MHD_set_connection_option() will reset timeout timer.
    */
   MHD_CONNECTION_OPTION_TIMEOUT
 
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index c3c7be8b..a883e4d9 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -2373,11 +2373,15 @@ MHD_update_last_activity_ (struct MHD_Connection 
*connection)
 {
   struct MHD_Daemon *daemon = connection->daemon;
 
+  if (0 == connection->connection_timeout)
+    return; /* Skip update of activity for connections
+               without timeout timer. */
+  if (connection->suspended)
+    return; /* no activity on suspended connections */
+
   connection->last_activity = MHD_monotonic_sec_counter();
   if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION))
     return; /* each connection has personal timeout */
-  if (connection->suspended)
-    return; /* not timeouts for suspended connections */
 
   if (connection->connection_timeout != daemon->connection_timeout)
     return; /* custom timeout, no need to move it in "normal" DLL */
@@ -3373,6 +3377,9 @@ MHD_set_connection_option (struct MHD_Connection 
*connection,
   switch (option)
     {
     case MHD_CONNECTION_OPTION_TIMEOUT:
+      if (0 == connection->connection_timeout)
+        connection->last_activity = MHD_monotonic_sec_counter();
+
       MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex);
       if ( (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) &&
           (! connection->suspended) )
diff --git a/src/microhttpd/connection.h b/src/microhttpd/connection.h
index 0bd891d9..d885f3f7 100644
--- a/src/microhttpd/connection.h
+++ b/src/microhttpd/connection.h
@@ -142,6 +142,6 @@ MHD_connection_epoll_update_ (struct MHD_Connection 
*connection);
  * @param connection the connection that saw some activity
  */
 void
-update_last_activity (struct MHD_Connection *connection);
+MHD_update_last_activity_ (struct MHD_Connection *connection);
 
 #endif

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



reply via email to

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