gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [libmicrohttpd] branch master updated (3ed13051 -> 8851d88e


From: gnunet
Subject: [GNUnet-SVN] [libmicrohttpd] branch master updated (3ed13051 -> 8851d88e)
Date: Wed, 05 Apr 2017 22:22:19 +0200

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

karlson2k pushed a change to branch master
in repository libmicrohttpd.

    from 3ed13051 Updated autoinit_funcs.h to latest upstream version with 
proper support of Oracle/Sun compiler.
     new 076cbfbe daemon.c: Removed useless extra ";"
     new 8851d88e Fixed hypothetical situation when timeout could be larger 
than possible to measure. Fixed detecting real closest timeout deadline when 
value wraps upper limit. Fixed compiler warnings.

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

diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index 0b6ce3bd..70c7268e 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -3245,7 +3245,7 @@ MHD_connection_handle_idle (struct MHD_Connection 
*connection)
     }
   if (! connection->suspended)
     {
-      unsigned int timeout;
+      time_t timeout;
       timeout = connection->connection_timeout;
       if ( (0 != timeout) &&
            (timeout < (MHD_monotonic_sec_counter() - 
connection->last_activity)) )
@@ -3377,7 +3377,8 @@ MHD_get_connection_info (struct MHD_Connection 
*connection,
     case MHD_CONNECTION_INFO_CONNECTION_SUSPENDED:
       return (const union MHD_ConnectionInfo *) &connection->suspended;
     case MHD_CONNECTION_INFO_CONNECTION_TIMEOUT:
-      return (const union MHD_ConnectionInfo *) 
&connection->connection_timeout;
+      connection->connection_timeout_dummy = connection->connection_timeout;
+      return (const union MHD_ConnectionInfo *) 
&connection->connection_timeout_dummy;
     default:
       return NULL;
     };
diff --git a/src/microhttpd/connection_https.c 
b/src/microhttpd/connection_https.c
index fe197f1d..9b441a9a 100644
--- a/src/microhttpd/connection_https.c
+++ b/src/microhttpd/connection_https.c
@@ -132,7 +132,7 @@ MHD_tls_connection_handle_write (struct MHD_Connection 
*connection)
 static int
 MHD_tls_connection_handle_idle (struct MHD_Connection *connection)
 {
-  unsigned int timeout;
+  time_t timeout;
 
 #if DEBUG_STATES
   MHD_DLOG (connection->daemon,
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index c2bd59f8..b92d5534 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -1803,7 +1803,7 @@ thread_main_handle_connection (void *data)
   while ( (! daemon->shutdown) &&
          (MHD_CONNECTION_CLOSED != con->state) )
     {
-      const unsigned int timeout = daemon->connection_timeout;
+      const time_t timeout = daemon->connection_timeout;
 #ifdef UPGRADE_SUPPORT
       struct MHD_UpgradeResponseHandle * const urh = con->urh;
 #else  /* ! UPGRADE_SUPPORT */
@@ -3269,14 +3269,14 @@ MHD_get_timeout (struct MHD_Daemon *daemon,
     }
 #endif /* EPOLL_SUPPORT */
 
-  have_timeout = false;;
+  have_timeout = false;
   earliest_deadline = 0; /* avoid compiler warnings */
   for (pos = daemon->manual_timeout_tail; NULL != pos; pos = pos->prevX)
     {
       if (0 != pos->connection_timeout)
        {
          if ( (! have_timeout) ||
-              (earliest_deadline > pos->last_activity + 
pos->connection_timeout) )
+              (earliest_deadline - pos->last_activity > 
pos->connection_timeout) )
            earliest_deadline = pos->last_activity + pos->connection_timeout;
          have_timeout = true;
        }
@@ -3287,7 +3287,7 @@ MHD_get_timeout (struct MHD_Daemon *daemon,
        (0 != pos->connection_timeout) )
     {
       if ( (! have_timeout) ||
-          (earliest_deadline > pos->last_activity + pos->connection_timeout) )
+          (earliest_deadline - pos->connection_timeout > pos->last_activity) )
        earliest_deadline = pos->last_activity + pos->connection_timeout;
       have_timeout = true;
     }
@@ -4766,6 +4766,7 @@ parse_options_va (struct MHD_Daemon *daemon,
   enum MHD_OPTION opt;
   struct MHD_OptionItem *oa;
   unsigned int i;
+  unsigned int uv;
 #ifdef HTTPS_SUPPORT
   int ret;
   const char *pstr;
@@ -4788,8 +4789,18 @@ parse_options_va (struct MHD_Daemon *daemon,
                                              unsigned int);
           break;
         case MHD_OPTION_CONNECTION_TIMEOUT:
-          daemon->connection_timeout = va_arg (ap,
-                                               unsigned int);
+          uv = va_arg (ap,
+                       unsigned int);
+          if (TIME_T_MAX < uv)
+            {
+#ifdef HAVE_MESSAGES
+              MHD_DLOG (daemon,
+                        _("Warning: Too large timeout value, ignored.\n"));
+#endif
+              daemon->connection_timeout = 0;
+            }
+          else
+            daemon->connection_timeout = (time_t)uv;
           break;
         case MHD_OPTION_NOTIFY_COMPLETED:
           daemon->notify_completed = va_arg (ap,
diff --git a/src/microhttpd/internal.h b/src/microhttpd/internal.h
index 1b9df892..9ced47c1 100644
--- a/src/microhttpd/internal.h
+++ b/src/microhttpd/internal.h
@@ -789,7 +789,12 @@ struct MHD_Connection
    * After how many seconds of inactivity should
    * this connection time out?  Zero for no timeout.
    */
-  unsigned int connection_timeout;
+  time_t connection_timeout;
+
+  /**
+   * Special member to be returned by #MHD_get_connection_info()
+   */
+  unsigned int connection_timeout_dummy;
 
   /**
    * Did we ever call the "default_handler" on this connection?  (this
@@ -1517,7 +1522,7 @@ struct MHD_Daemon
    * After how many seconds of inactivity should
    * connections time out?  Zero for no timeout.
    */
-  unsigned int connection_timeout;
+  time_t connection_timeout;
 
   /**
    * Maximum number of connections per IP, or 0 for

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



reply via email to

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