commit db0b0e4208cd38eeaf9bee7c41566afb8e1e8633
parent 735bf2d2aaf92a54ed463ed4ae7198fb95d48c20
Author: Christian Grothoff <christian@grothoff.org>
Date: Mon, 16 Nov 2009 13:40:10 +0000
better, and check against overflow
Diffstat:
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/daemon/daemon.c b/src/daemon/daemon.c
@@ -493,12 +493,12 @@ MHD_handle_connection (void *data)
struct pollfd p;
timeout = con->daemon->connection_timeout;
- if (timeout == 0)
- timeout = -1; /* 'forever' */
while ((!con->daemon->shutdown) && (con->socket_fd != -1)) {
now = time (NULL);
tv.tv_usec = 0;
- if (timeout > (now - con->last_activity))
+ if ( ( (timeout > (now - con->last_activity)) &&
+ (now > con->last_activity) ) ||
+ (timeout == 0) )
{
/* in case we are missing the SIGALRM, keep going after
at most 1s; see http://lists.gnu.org/archive/html/libmicrohttpd/2009-10/msg00013.html */