From: wessels <> Date: Sat, 6 Apr 1996 04:51:45 +0000 (+0000) Subject: add negative_dns_ttl config option X-Git-Tag: SQUID_3_0_PRE1~6271 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=61d6fc5ce8adc2d68abe39bc1bd97831727b2d9d;p=thirdparty%2Fsquid.git add negative_dns_ttl config option --- diff --git a/src/cache_cf.cc b/src/cache_cf.cc index 8b39b1627e..7723d8aff2 100644 --- a/src/cache_cf.cc +++ b/src/cache_cf.cc @@ -1,4 +1,4 @@ -/* $Id: cache_cf.cc,v 1.18 1996/04/04 18:51:02 wessels Exp $ */ +/* $Id: cache_cf.cc,v 1.19 1996/04/05 21:51:45 wessels Exp $ */ /* DEBUG: Section 3 cache_cf: Configuration file parsing */ @@ -22,6 +22,7 @@ static struct { int relayPort; } Wais; int negativeTtl; + int negativeDnsTtl; int readTimeout; int lifetimeDefault; int connectTimeout; @@ -85,6 +86,7 @@ static struct { #define DefaultWaisRelayPort -1 #define DefaultNegativeTtl (5 * 60) /* 5 min */ +#define DefaultNegativeDnsTtl (2 * 60) /* 2 min */ #define DefaultReadTimeout (15 * 60) /* 15 min */ #define DefaultLifetimeDefault (200 * 60) /* 3+ hours */ #define DefaultConnectTimeout (2 * 60) /* 2 min */ @@ -642,6 +644,15 @@ static void parseNegativeLine(line_in) Config.negativeTtl = i * 60; } +static void parseNegativeDnsLine(line_in) + char *line_in; +{ + char *token; + int i; + GetInteger(i); + Config.negativeDnsTtl = i * 60; +} + static void parseReadTimeoutLine(line_in) char *line_in; { @@ -1273,6 +1284,10 @@ int parseConfigFile(file_name) else if (!strcmp(token, "negative_ttl")) parseNegativeLine(line_in); + /* Parse a negative_dns_ttl line */ + else if (!strcmp(token, "negative_dns_ttl")) + parseNegativeDnsLine(line_in); + /* Parse a read_timeout line */ else if (!strcmp(token, "read_timeout")) parseReadTimeoutLine(line_in); @@ -1462,6 +1477,10 @@ int getNegativeTTL() { return Config.negativeTtl; } +int getNegativeDNSTTL() +{ + return Config.negativeDnsTtl; +} int getCacheMemMax() { return Config.Mem.maxSize; diff --git a/src/ipcache.cc b/src/ipcache.cc index 4a6d8862fb..503d3f63f9 100644 --- a/src/ipcache.cc +++ b/src/ipcache.cc @@ -1,4 +1,4 @@ -/* $Id: ipcache.cc,v 1.14 1996/04/05 17:48:31 wessels Exp $ */ +/* $Id: ipcache.cc,v 1.15 1996/04/05 21:51:46 wessels Exp $ */ /* * DEBUG: Section 14 ipcache: IP Cache @@ -12,7 +12,6 @@ char ipcache_status_char _PARAMS((ipcache_entry *)); int ipcache_hash_entry_count(); #define IP_POS_TTL 86400 /* one day */ -#define IP_NEG_TTL 120 /* 2 minutes */ #define MAX_IP 1024 /* Maximum cached IP */ #define IP_LOW_WATER 70 #define IP_HIGH_WATER 90 @@ -452,7 +451,7 @@ void ipcache_add(name, e, data, cached) } else { e->lastref = e->timestamp = cached_curtime; e->status = NEGATIVE_CACHED; - e->ttl = IP_NEG_TTL; + e->ttl = getNegativeDNSTTL(); } ipcache_add_to_hash(e); @@ -515,7 +514,7 @@ void ipcache_update_content(name, e, data, cached) } else { e->lastref = e->timestamp = cached_curtime; e->status = NEGATIVE_CACHED; - e->ttl = IP_NEG_TTL; + e->ttl = getNegativeDNSTTL(); } } @@ -741,7 +740,7 @@ int ipcache_parsebuffer(buf, offset, data) plist = globalpending_search(token, data->global_pending); if (plist) { plist->entry->lastref = plist->entry->timestamp = cached_curtime; - plist->entry->ttl = IP_NEG_TTL; + plist->entry->ttl = getNegativeDNSTTL(); plist->entry->status = NEGATIVE_CACHED; ipcache_call_pending(plist->entry); globalpending_remove(plist, data);