From db0b0e4208cd38eeaf9bee7c41566afb8e1e8633 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 16 Nov 2009 13:40:10 +0000 Subject: [PATCH] better, and check against overflow --- src/daemon/daemon.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/daemon/daemon.c b/src/daemon/daemon.c index 1d35db7b..09ef7a6d 100644 --- 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 */