From: adrian <> Date: Sat, 2 Sep 2006 16:39:53 +0000 (+0000) Subject: Break checkTimeouts() out of each of the comm_select() routines, fixing kqueue's... X-Git-Tag: SQUID_3_0_PRE5~153 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fa3f745bbd55dd7b4209b34d6584919e5bb296f2;p=thirdparty%2Fsquid.git Break checkTimeouts() out of each of the comm_select() routines, fixing kqueue's in the process --- diff --git a/src/comm.cc b/src/comm.cc index d5e4b84cf0..5e92d8aa7c 100644 --- a/src/comm.cc +++ b/src/comm.cc @@ -1,6 +1,6 @@ /* - * $Id: comm.cc,v 1.421 2006/08/12 01:43:11 robertc Exp $ + * $Id: comm.cc,v 1.422 2006/09/02 10:39:53 adrian Exp $ * * DEBUG: section 5 Socket Functions * AUTHOR: Harvest Derived @@ -2655,6 +2655,14 @@ CommDispatcher::dispatch() { int CommSelectEngine::checkEvents(int timeout) { + static time_t last_timeout = 0; + + /* No, this shouldn't be here. But it shouldn't be in each comm handler. -adrian */ + if (squid_curtime > last_timeout) { + last_timeout = squid_curtime; + checkTimeouts(); + } + switch (comm_select(timeout)) { case COMM_OK: diff --git a/src/comm_epoll.cc b/src/comm_epoll.cc index fe030dc3a0..8453fdb75f 100644 --- a/src/comm_epoll.cc +++ b/src/comm_epoll.cc @@ -1,6 +1,6 @@ /* - * $Id: comm_epoll.cc,v 1.11 2006/05/29 21:44:18 robertc Exp $ + * $Id: comm_epoll.cc,v 1.12 2006/09/02 10:39:53 adrian Exp $ * * DEBUG: section 5 Socket functions * @@ -234,12 +234,6 @@ comm_select(int msec) PF *hdl; struct epoll_event *cevents; - static time_t last_timeout = 0; - - if (squid_curtime > last_timeout) { - last_timeout = squid_curtime; - checkTimeouts(); - } PROF_start(comm_check_incoming); diff --git a/src/comm_poll.cc b/src/comm_poll.cc index 5e7d4b3c01..4da3b2e8c4 100644 --- a/src/comm_poll.cc +++ b/src/comm_poll.cc @@ -1,6 +1,6 @@ /* - * $Id: comm_poll.cc,v 1.18 2006/08/12 01:43:11 robertc Exp $ + * $Id: comm_poll.cc,v 1.19 2006/09/02 10:39:53 adrian Exp $ * * DEBUG: section 5 Socket Functions * @@ -369,7 +369,6 @@ comm_select(int msec) int num; int callicp = 0, callhttp = 0; int calldns = 0; - static time_t last_timeout = 0; double timeout = current_dtime + (msec / 1000.0); do { @@ -471,12 +470,6 @@ comm_select(int msec) debug(5, num ? 5 : 8) ("comm_poll: %d+%ld FDs ready\n", num, npending); statHistCount(&statCounter.select_fds_hist, num); - /* Check timeout handlers ONCE each second. */ - - if (squid_curtime > last_timeout) { - last_timeout = squid_curtime; - checkTimeouts(); - } if (num == 0 && npending == 0) continue; diff --git a/src/comm_select.cc b/src/comm_select.cc index 6cf9f9f04a..5cb1a9ab2a 100644 --- a/src/comm_select.cc +++ b/src/comm_select.cc @@ -1,6 +1,6 @@ /* - * $Id: comm_select.cc,v 1.76 2006/05/29 00:15:02 robertc Exp $ + * $Id: comm_select.cc,v 1.77 2006/09/02 10:39:53 adrian Exp $ * * DEBUG: section 5 Socket Functions * @@ -387,7 +387,6 @@ comm_select(int msec) fd_mask *fdsp; fd_mask *pfdsp; fd_mask tmask; - static time_t last_timeout = 0; struct timeval poll_time; double timeout = current_dtime + (msec / 1000.0); @@ -509,13 +508,6 @@ comm_select(int msec) statHistCount(&statCounter.select_fds_hist, num); - /* Check lifetime and timeout handlers ONCE each second. - * Replaces brain-dead check every time through the loop! */ - if (squid_curtime > last_timeout) { - last_timeout = squid_curtime; - checkTimeouts(); - } - if (num == 0 && pending == 0) continue; diff --git a/src/comm_select_win32.cc b/src/comm_select_win32.cc index b635b6f4cb..17052d0740 100644 --- a/src/comm_select_win32.cc +++ b/src/comm_select_win32.cc @@ -1,6 +1,6 @@ /* - * $Id: comm_select_win32.cc,v 1.1 2006/06/13 20:52:05 serassio Exp $ + * $Id: comm_select_win32.cc,v 1.2 2006/09/02 10:39:53 adrian Exp $ * * DEBUG: section 5 Socket Functions * @@ -384,9 +384,6 @@ comm_select(int msec) int i; #endif - - static time_t last_timeout = 0; - struct timeval poll_time; double timeout = current_dtime + (msec / 1000.0); fde *F; @@ -511,13 +508,6 @@ comm_select(int msec) statHistCount(&statCounter.select_fds_hist, num); - /* Check lifetime and timeout handlers ONCE each second. - * Replaces brain-dead check every time through the loop! */ - if (squid_curtime > last_timeout) { - last_timeout = squid_curtime; - checkTimeouts(); - } - if (num == 0 && pending == 0) continue;