From: wessels <> Date: Wed, 30 Sep 1998 10:34:06 +0000 (+0000) Subject: make delayPoolsUpdate() an event X-Git-Tag: SQUID_3_0_PRE1~2617 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c59d39c469f085398b118e11c03cd355422df57e;p=thirdparty%2Fsquid.git make delayPoolsUpdate() an event --- diff --git a/src/comm_select.cc b/src/comm_select.cc index 19316c07ef..7c4bc14816 100644 --- a/src/comm_select.cc +++ b/src/comm_select.cc @@ -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; diff --git a/src/delay_pools.cc b/src/delay_pools.cc index de6740f986..29efde0f9b 100644 --- a/src/delay_pools.cc +++ b/src/delay_pools.cc @@ -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 @@ -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); } /* diff --git a/src/protos.h b/src/protos.h index e01d322d09..76d6401122 100644 --- a/src/protos.h +++ b/src/protos.h @@ -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);