]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
make delayPoolsUpdate() an event
authorwessels <>
Wed, 30 Sep 1998 10:34:06 +0000 (10:34 +0000)
committerwessels <>
Wed, 30 Sep 1998 10:34:06 +0000 (10:34 +0000)
src/comm_select.cc
src/delay_pools.cc
src/protos.h

index 19316c07efe40e64d2618433d39afad491573443..7c4bc148167ba455a7b21f930b914a2685b3410a 100644 (file)
@@ -1,7 +1,7 @@
 
 
 /*
- * $Id: comm_select.cc,v 1.11 1998/09/15 19:37:46 wessels Exp $
+ * $Id: comm_select.cc,v 1.12 1998/09/30 04:34:06 wessels Exp $
  *
  * DEBUG: section 5     Socket Functions
  *
@@ -280,12 +280,6 @@ comm_poll(int msec)
            comm_poll_icp_incoming();
        if (commCheckHTTPIncoming)
            comm_poll_http_incoming();
-#if DELAY_POOLS
-       if (squid_curtime > delay_pools_last_update) {
-           delayPoolsUpdate(squid_curtime - delay_pools_last_update);
-           delay_pools_last_update = squid_curtime;
-       }
-#endif
        callicp = callhttp = 0;
        nfds = 0;
        maxfd = Biggest_FD + 1;
@@ -548,12 +542,6 @@ comm_select(int msec)
            comm_select_icp_incoming();
        if (commCheckHTTPIncoming)
            comm_select_http_incoming();
-#if DELAY_POOLS
-       if (squid_curtime > delay_pools_last_update) {
-           delayPoolsUpdate(squid_curtime - delay_pools_last_update);
-           delay_pools_last_update = squid_curtime;
-       }
-#endif
        callicp = callhttp = 0;
        nfds = 0;
        maxfd = Biggest_FD + 1;
index de6740f986f451521d1b63cf223ddb011b0cd961..29efde0f9bef563bddb2a990c6aee4be7adc5872 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: delay_pools.cc,v 1.4 1998/08/20 22:29:56 wessels Exp $
+ * $Id: delay_pools.cc,v 1.5 1998/09/30 04:34:07 wessels Exp $
  *
  * DEBUG: section 77    Delay Pools
  * AUTHOR: David Luyer <luyer@ucs.uwa.edu.au>
@@ -58,6 +58,7 @@ struct _delayData {
 
 static struct _delayData delay_data;
 static OBJH delayPoolStats;
+static time_t delay_pools_last_update = 0;
 static delay_id delayId(unsigned char class, int position);
 
 static delay_id
@@ -156,13 +157,18 @@ delayClient(clientHttpRequest * http)
 
 
 void
-delayPoolsUpdate(int incr)
+delayPoolsUpdate(void *unused)
 {
+    int incr = squid_curtime - delay_pools_last_update;
     int i;
     int j;
     int mpos;
     int individual_restore_bytes;
     int network_restore_bytes;
+    eventAdd("delayPoolsUpdate", delayPoolsUpdate, NULL, 1.0, 1);
+    if (incr < 1)
+       return;
+    delay_pools_last_update = squid_curtime;
     /* Increment 3 aggregate pools */
     if (Config.Delay.class1.aggregate.restore_bps != -1 &&
        (delay_data.class1_aggregate +=
@@ -333,6 +339,7 @@ delayPoolsInit(void)
     delay_data.class3_aggregate = Config.Delay.class3.aggregate.restore_bps;
     delay_data.class3_network_map[0] = 255;
     cachemgrRegister("delay", "Delay Pool Levels", delayPoolStats, 0, 1);
+    eventAdd("delayPoolsUpdate", delayPoolsUpdate, NULL, 1.0, 1);
 }
 
 /*
index e01d322d09d935fd0e23cf7f70534818c092a0a1..76d640112248f3efb44f066d0a98854ffef660a9 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: protos.h,v 1.273 1998/09/29 01:33:00 wessels Exp $
+ * $Id: protos.h,v 1.274 1998/09/30 04:34:08 wessels Exp $
  *
  *
  * SQUID Internet Object Cache  http://squid.nlanr.net/Squid/
@@ -1069,7 +1069,7 @@ extern peer *carpSelectParent(request_t *);
 #if DELAY_POOLS
 extern int delayClient(clientHttpRequest *);
 extern void delayPoolsInit(void);
-extern void delayPoolsUpdate(int);
+extern EVH delayPoolsUpdate;
 extern int delayMostBytesWanted(const MemObject * mem, int max);
 extern int delayMostBytesAllowed(const MemObject * mem);
 extern void delayBytesIn(delay_id, int qty);