diff options
Diffstat (limited to 'src/daemon/daemon.c')
-rw-r--r-- | src/daemon/daemon.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/daemon/daemon.c b/src/daemon/daemon.c index 2b8eac5f..47c7c527 100644 --- a/src/daemon/daemon.c +++ b/src/daemon/daemon.c | |||
@@ -1204,6 +1204,7 @@ MHD_get_timeout (struct MHD_Daemon *daemon, | |||
1204 | time_t earliest_deadline; | 1204 | time_t earliest_deadline; |
1205 | time_t now; | 1205 | time_t now; |
1206 | struct MHD_Connection *pos; | 1206 | struct MHD_Connection *pos; |
1207 | int have_timeout = MHD_NO; | ||
1207 | 1208 | ||
1208 | if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) | 1209 | if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) |
1209 | { | 1210 | { |
@@ -1215,19 +1216,22 @@ MHD_get_timeout (struct MHD_Daemon *daemon, | |||
1215 | pos = daemon->connections_head; | 1216 | pos = daemon->connections_head; |
1216 | if (pos == NULL) | 1217 | if (pos == NULL) |
1217 | return MHD_NO; /* no connections */ | 1218 | return MHD_NO; /* no connections */ |
1218 | earliest_deadline = pos->last_activity + pos->connection_timeout; | ||
1219 | pos = pos->next; | ||
1220 | while (pos != NULL) | 1219 | while (pos != NULL) |
1221 | { | 1220 | { |
1222 | if (earliest_deadline > pos->last_activity + pos->connection_timeout) | 1221 | if (0 != pos->connection_timeout) { |
1223 | earliest_deadline = pos->last_activity + pos->connection_timeout; | 1222 | have_timeout = MHD_YES; |
1223 | if (earliest_deadline > pos->last_activity + pos->connection_timeout) | ||
1224 | earliest_deadline = pos->last_activity + pos->connection_timeout; | ||
1224 | #if HTTPS_SUPPORT | 1225 | #if HTTPS_SUPPORT |
1225 | if ( (0 != (daemon->options & MHD_USE_SSL)) && | 1226 | if ( (0 != (daemon->options & MHD_USE_SSL)) && |
1226 | (0 != gnutls_record_check_pending (pos->tls_session)) ) | 1227 | (0 != gnutls_record_check_pending (pos->tls_session)) ) |
1227 | earliest_deadline = 0; | 1228 | earliest_deadline = 0; |
1228 | #endif | 1229 | #endif |
1230 | } | ||
1229 | pos = pos->next; | 1231 | pos = pos->next; |
1230 | } | 1232 | } |
1233 | if (!have_timeout) | ||
1234 | return MHD_NO; | ||
1231 | now = time (NULL); | 1235 | now = time (NULL); |
1232 | if (earliest_deadline < now) | 1236 | if (earliest_deadline < now) |
1233 | *timeout = 0; | 1237 | *timeout = 0; |