]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
add negative_dns_ttl config option
authorwessels <>
Sat, 6 Apr 1996 04:51:45 +0000 (04:51 +0000)
committerwessels <>
Sat, 6 Apr 1996 04:51:45 +0000 (04:51 +0000)
src/cache_cf.cc
src/ipcache.cc

index 8b39b1627e88fb22c1540b6fc842c545dc7d5cb8..7723d8aff25ab6be5c3dd3ac13e8839c6c6b4625 100644 (file)
@@ -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;
index 4a6d8862fb469b791bd7cdca3ccb1e5ff0301c9b..503d3f63f94e5d1b4ce87147df87a87bb9f678f5 100644 (file)
@@ -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);