]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Added 'minimum_direct_hops' feature
authorwessels <>
Wed, 9 Oct 1996 01:37:33 +0000 (01:37 +0000)
committerwessels <>
Wed, 9 Oct 1996 01:37:33 +0000 (01:37 +0000)
src/cache_cf.cc
src/net_db.cc

index 3c5879017291b9370241502295668589f975ae58..9cbdce6af070f968266d2a4b2231298dcd5c1fbd 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: cache_cf.cc,v 1.102 1996/10/07 17:14:52 wessels Exp $
+ * $Id: cache_cf.cc,v 1.103 1996/10/08 19:37:33 wessels Exp $
  *
  * DEBUG: section 3     Configuration File Parsing
  * AUTHOR: Harvest Derived
@@ -197,6 +197,7 @@ struct SquidConfig Config;
 #define DefaultIpcacheLow      90
 #define DefaultIpcacheHigh     95
 #define DefaultMaxHotvmObjSize (256<<10)       /* 256k */
+#define DefaultMinDirectHops   4
 
 int httpd_accel_mode = 0;      /* for fast access */
 char *DefaultSwapDir = DEFAULT_SWAP_DIR;
@@ -1365,6 +1366,9 @@ parseConfigFile(char *file_name)
        else if (!strcmp(token, "max_hotvm_obj_size"))
            parseIntegerValue(&Config.maxHotvmObjSize);
 
+       else if (!strcmp(token, "minimum_direct_hops"))
+           parseIntegerValue(&Config.minDirectHops);
+
        /* If unknown, treat as a comment line */
        else {
            debug(3, 0, "parseConfigFile: line %d unrecognized: '%s'\n",
@@ -1566,6 +1570,7 @@ configSetFactoryDefaults(void)
     Config.ipcache.low = DefaultIpcacheLow;
     Config.ipcache.high = DefaultIpcacheHigh;
     Config.maxHotvmObjSize = DefaultMaxHotvmObjSize;
+    Config.minDirectHops = DefaultMinDirectHops;
 }
 
 static void
index 4618c179a11e2ce13a285a2a75d8bccd6e824c5b..4d5501c00121875c93d529260a078b18abd99d3a 100644 (file)
@@ -186,6 +186,7 @@ netdbSendPing(int fdunused, struct hostent *hp, void *data)
        n = netdbAdd(addr, hostname);
     debug(37, 3, "netdbSendPing: pinging %s\n", hostname);
     icmpDomainPing(addr, hostname);
+    n->pings_sent++;
     n->next_ping_time = squid_curtime + NET_DB_TTL;
     n->last_use_time = squid_curtime;
     xfree(hostname);
@@ -213,6 +214,7 @@ netdbHandlePingReply(struct sockaddr_in *from, int hops, int rtt)
        N = 100;
     n->hops = ((n->hops * (N - 1)) + hops) / N;
     n->rtt = ((n->rtt * (N - 1)) + rtt) / N;
+    n->pings_recv++;
     debug(37, 3, "netdbHandlePingReply: %s; rtt=%5.1f  hops=%4.1f\n",
        n->network,
        n->rtt,
@@ -281,4 +283,12 @@ netdbDump(StoreEntry * sentry)
     xfree(list);
 }
 
+int
+netdbHops(struct in_addr addr)
+{
+    netdbEntry *n = netdbLookupAddr(addr);
+    if (n && n->pings_recv)
+       return (int) (n->hops + 0.5);
+    return 256;
+}
 #endif /* USE_ICMP */