]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
skip peerRefreshDNS if there is no recent traffic
authorwessels <>
Thu, 21 May 1998 09:22:43 +0000 (09:22 +0000)
committerwessels <>
Thu, 21 May 1998 09:22:43 +0000 (09:22 +0000)
src/neighbors.cc
src/protos.h
src/stat.cc

index 2d3551f7de42fae65a8cc7d2c7b563468e3c8b6d..44a7db36066c7c143368f9055fd5c31d540ba5ec 100644 (file)
@@ -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);
 }
index 4186cbbaf806339074bfd8433533832fbf3b14b0..ab9df96e3be72c7ff917b2f7f98aac99d961c223 100644 (file)
@@ -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);
index 54af8fda16faacf2232b8cf78d144cd9267d7eff..c1fd9ff70ed5898ce6e31875da658797e758a593 100644 (file)
@@ -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
 /*