From: wessels <> Date: Wed, 9 Oct 1996 01:37:33 +0000 (+0000) Subject: Added 'minimum_direct_hops' feature X-Git-Tag: SQUID_3_0_PRE1~5697 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4d311579def3b9f358dc54839bae6eb6dbcc7206;p=thirdparty%2Fsquid.git Added 'minimum_direct_hops' feature --- diff --git a/src/cache_cf.cc b/src/cache_cf.cc index 3c58790172..9cbdce6af0 100644 --- a/src/cache_cf.cc +++ b/src/cache_cf.cc @@ -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 diff --git a/src/net_db.cc b/src/net_db.cc index 4618c179a1..4d5501c001 100644 --- a/src/net_db.cc +++ b/src/net_db.cc @@ -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 */