]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Break checkTimeouts() out of each of the comm_select() routines, fixing kqueue's...
authoradrian <>
Sat, 2 Sep 2006 16:39:53 +0000 (16:39 +0000)
committeradrian <>
Sat, 2 Sep 2006 16:39:53 +0000 (16:39 +0000)
src/comm.cc
src/comm_epoll.cc
src/comm_poll.cc
src/comm_select.cc
src/comm_select_win32.cc

index d5e4b84cf07335160c5f995698f3062b23076bf6..5e92d8aa7c486e45b60904ecdf8fe50b7ff91f00 100644 (file)
@@ -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:
index fe030dc3a05240cc0223577551f768d06bb37512..8453fdb75f5b26f9126002f0acf99fa72c825478 100644 (file)
@@ -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);
 
index 5e7d4b3c011decd121b32798626c3f64b424dcf8..4da3b2e8c4ee19cb5c490ac6cdd1c76f69e09127 100644 (file)
@@ -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;
index 6cf9f9f04a525f2ec2ae8c3126b00fabaa36d80e..5cb1a9ab2af6a85eb417119e28eb9aa625df8cc2 100644 (file)
@@ -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;
 
index b635b6f4cbd562c1389a2122139f06662bd1f5fb..17052d0740d7a9bd0dc8c77ec86c0f3af8393cc6 100644 (file)
@@ -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;