From 60e745695acdcbc575e50ca41d5f4b16cb6ff12f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20B=C3=BChler?= Date: Thu, 11 Jun 2009 14:04:57 +0000 Subject: [PATCH] Fix 100% cpu usage if time() < 0 (thx to gaspa and cate, fixes #1964) git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2532 152afb58-edef-0310-8abb-c4023f1b3aa9 --- NEWS | 1 + src/connections.c | 8 ++++---- tests/docroot/www/Makefile.am | 3 ++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/NEWS b/NEWS index add794f6..076d55d5 100644 --- a/NEWS +++ b/NEWS @@ -54,6 +54,7 @@ NEWS * Adding support for additional chars in LDAP usernames (fixes #1941) * Ignore multiple "If-None-Match" headers (only use first one, fixes #753) * Add X-Sendfile-Range feature (fixes #2005) + * Fix 100% cpu usage if time() < 0 (thx to gaspa and cate, fixes #1964) - 1.4.22 - 2009-03-07 * Fix wrong lua type for CACHE_MISS/CACHE_HIT in mod_cml (fixes #533) diff --git a/src/connections.c b/src/connections.c index 928376ab..bddb9146 100644 --- a/src/connections.c +++ b/src/connections.c @@ -1183,7 +1183,7 @@ static handler_t connection_handle_fdevent(void *s, void *context, int revents) /* FIXME: revents = 0x19 still means that we should read from the queue */ if (revents & FDEVENT_HUP) { if (con->state == CON_STATE_CLOSE) { - con->close_timeout_ts = 0; + con->close_timeout_ts = srv->cur_ts - 2; } else { /* sigio reports the wrong event here * @@ -1252,7 +1252,7 @@ static handler_t connection_handle_fdevent(void *s, void *context, int revents) } else { /* nothing to read */ - con->close_timeout_ts = 0; + con->close_timeout_ts = srv->cur_ts - 2; } } @@ -1604,10 +1604,10 @@ int connection_state_machine(server *srv, connection *con) { } else { /* nothing to read */ - con->close_timeout_ts = 0; + con->close_timeout_ts = srv->cur_ts - 2; } } else { - con->close_timeout_ts = 0; + con->close_timeout_ts = srv->cur_ts - 2; } if (srv->cur_ts - con->close_timeout_ts > 1) { diff --git a/tests/docroot/www/Makefile.am b/tests/docroot/www/Makefile.am index f535cb25..ce53f90d 100644 --- a/tests/docroot/www/Makefile.am +++ b/tests/docroot/www/Makefile.am @@ -1,5 +1,6 @@ EXTRA_DIST=cgi.php cgi.pl index.html index.txt phpinfo.php \ redirect.php cgi-pathinfo.pl get-env.php get-server-env.php \ nph-status.pl prefix.fcgi get-header.pl ssi.shtml get-post-len.pl \ - exec-date.shtml 404.fcgi 404.html 404.pl send404.pl crlfcrash.pl + exec-date.shtml 404.fcgi 404.html 404.pl send404.pl crlfcrash.pl \ + sendfile.php SUBDIRS=go indexfile expire