gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r12470 - in libmicrohttpd: . src/daemon


From: gnunet
Subject: [GNUnet-SVN] r12470 - in libmicrohttpd: . src/daemon
Date: Thu, 5 Aug 2010 22:41:23 +0200

Author: grothoff
Date: 2010-08-05 22:41:23 +0200 (Thu, 05 Aug 2010)
New Revision: 12470

Modified:
   libmicrohttpd/ChangeLog
   libmicrohttpd/src/daemon/connection.c
   libmicrohttpd/src/daemon/daemon.c
Log:
fixing time underflow bug

Modified: libmicrohttpd/ChangeLog
===================================================================
--- libmicrohttpd/ChangeLog     2010-08-05 15:45:37 UTC (rev 12469)
+++ libmicrohttpd/ChangeLog     2010-08-05 20:41:23 UTC (rev 12470)
@@ -1,3 +1,7 @@
+Thu Aug  5 22:24:37 CEST 2010
+       Fixing timeout bug on systems that think it's still
+       1970 (can happen if system time not initialized). -CG
+
 Mon Jul 26 10:46:57 CEST 2010
        Releasing libmicrohttpd 0.9.0. -CG
 

Modified: libmicrohttpd/src/daemon/connection.c
===================================================================
--- libmicrohttpd/src/daemon/connection.c       2010-08-05 15:45:37 UTC (rev 
12469)
+++ libmicrohttpd/src/daemon/connection.c       2010-08-05 20:41:23 UTC (rev 
12470)
@@ -2223,13 +2223,13 @@
     }
   timeout = connection->daemon->connection_timeout;
   if ((connection->socket_fd != -1) &&
-      (timeout != 0) && (time (NULL) - timeout > connection->last_activity))
+      (timeout != 0) &&
+      (timeout > (time (NULL) - con->last_activity)) )
     {
       MHD_connection_close (connection, 
MHD_REQUEST_TERMINATED_TIMEOUT_REACHED);
       return MHD_NO;
     }
   return MHD_YES;
-
 }
 
 void

Modified: libmicrohttpd/src/daemon/daemon.c
===================================================================
--- libmicrohttpd/src/daemon/daemon.c   2010-08-05 15:45:37 UTC (rev 12469)
+++ libmicrohttpd/src/daemon/daemon.c   2010-08-05 20:41:23 UTC (rev 12470)
@@ -486,7 +486,6 @@
   int max;
   struct timeval tv;
   unsigned int timeout;
-  time_t now;
 #ifdef HAVE_POLL_H
   struct MHD_Pollfd mp;
   struct pollfd p;
@@ -494,9 +493,8 @@
 
   timeout = con->daemon->connection_timeout;
   while ((!con->daemon->shutdown) && (con->socket_fd != -1)) {
-      now = time (NULL);
       tv.tv_usec = 0;
-      if ( (timeout > (now - con->last_activity)) ||
+      if ( (timeout > (time (NULL) - con->last_activity)) ||
           (timeout == 0) )
        {
          /* in case we are missing the SIGALRM, keep going after
@@ -1017,7 +1015,6 @@
   struct timeval timeout;
   unsigned long long ltimeout;
   int ds;
-  time_t now;
 
   timeout.tv_sec = 0;
   timeout.tv_usec = 0;
@@ -1090,7 +1087,6 @@
   if (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION))
     {
       /* do not have a thread per connection, process all connections now */
-      now = time (NULL);
       pos = daemon->connections;
       while (pos != NULL)
         {




reply via email to

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