]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Made overloaded dnsserver queues a soft error unless the queue is
authorhno <>
Wed, 10 Jan 2001 04:06:43 +0000 (04:06 +0000)
committerhno <>
Wed, 10 Jan 2001 04:06:43 +0000 (04:06 +0000)
completely stuck (3 minutes). This to handle internet-breakdowns more
gracefully when not using the internal DNS client.

src/dns.cc

index 57bb4b630f48fd7c3300c64dd348e29b09d4a798..ce0476596c18766718a4ad85aa00139a7feb4175 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: dns.cc,v 1.83 2000/05/31 08:57:08 hno Exp $
+ * $Id: dns.cc,v 1.84 2001/01/09 21:06:43 hno Exp $
  *
  * DEBUG: section 34    Dnsserver interface
  * AUTHOR: Harvest Derived
@@ -89,7 +89,17 @@ void
 dnsSubmit(const char *lookup, HLPCB * callback, void *data)
 {
     char buf[256];
+    static time_t first_warn = 0;
     snprintf(buf, 256, "%s\n", lookup);
+    if (dnsservers->stats.queue_size >= dnsservers->n_running * 2) {
+       if (first_warn == 0)
+           first_warn = squid_curtime;
+       if (squid_curtime - first_warn > 3*60)
+           fatal("DNS servers not responding for 3 minutes");
+       debug(34, 1) ("dnsSubmit: queue overload, rejecting %s\n", lookup);
+       callback(data, "$fail temporary network problem, pleas retry later");
+    }
+    first_warn = 0;
     helperSubmit(dnsservers, buf, callback, data);
 }