From: wessels <> Date: Thu, 21 May 1998 09:22:43 +0000 (+0000) Subject: skip peerRefreshDNS if there is no recent traffic X-Git-Tag: SQUID_3_0_PRE1~3297 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1f3c4622f82232ca54e9d31ec86f5b4791633d23;p=thirdparty%2Fsquid.git skip peerRefreshDNS if there is no recent traffic --- diff --git a/src/neighbors.cc b/src/neighbors.cc index 2d3551f7de..44a7db3606 100644 --- a/src/neighbors.cc +++ b/src/neighbors.cc @@ -1,6 +1,6 @@ /* - * $Id: neighbors.cc,v 1.212 1998/05/21 00:46:16 wessels Exp $ + * $Id: neighbors.cc,v 1.213 1998/05/21 03:22:43 wessels Exp $ * * DEBUG: section 15 Neighbor Routines * AUTHOR: Harvest Derived @@ -950,13 +950,13 @@ static void peerRefreshDNS(void *datanotused) { peer *p = NULL; - peer *next = Config.peers; - while ((p = next) != NULL) { - next = p->next; - /* some random, bogus FD for ipcache */ - p->test_fd = Squid_MaxFD + current_time.tv_usec; - ipcache_nbgethostbyname(p->host, peerDNSConfigure, p); + if (0 == stat5minClientRequests()) { + /* no recent client traffic, wait a bit */ + eventAddIsh("peerRefreshDNS", peerRefreshDNS, NULL, 180.0, 1); + return; } + for (p = Config.peers; p; p = p->next) + ipcache_nbgethostbyname(p->host, peerDNSConfigure, p); /* Reconfigure the peers every hour */ eventAddIsh("peerRefreshDNS", peerRefreshDNS, NULL, 3600.0, 1); } diff --git a/src/protos.h b/src/protos.h index 4186cbbaf8..ab9df96e3b 100644 --- a/src/protos.h +++ b/src/protos.h @@ -587,6 +587,8 @@ extern void identStart(int, ConnStateData *, IDCB * callback, void *); extern void statInit(void); extern double median_svc_get(int, int); extern void pconnHistCount(int, int); +extern int stat5minClientRequests(void); + /* StatHist */ extern void statHistClean(StatHist * H); diff --git a/src/stat.cc b/src/stat.cc index 54af8fda16..c1fd9ff70e 100644 --- a/src/stat.cc +++ b/src/stat.cc @@ -1,6 +1,6 @@ /* - * $Id: stat.cc,v 1.249 1998/05/15 17:16:21 wessels Exp $ + * $Id: stat.cc,v 1.250 1998/05/21 03:22:46 wessels Exp $ * * DEBUG: section 18 Cache Manager Statistics * AUTHOR: Harvest Derived @@ -1190,6 +1190,13 @@ snmpStatGet(int minutes) return &CountHist[minutes]; } +int +stat5minClientRequests(void) +{ + assert(N_COUNT_HIST > 5); + return Counter.client_http.requests - CountHist[5].client_http.requests; +} + #if STAT_GRAPHS /*