]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
give up retransmitting after (20) tries
authorwessels <>
Sun, 18 Apr 1999 11:44:55 +0000 (11:44 +0000)
committerwessels <>
Sun, 18 Apr 1999 11:44:55 +0000 (11:44 +0000)
src/dns_internal.cc

index 5ca70f9c34727ab92fc4e9172ae77749fb27f553..58ce57fe17a692baef591d1c74d38cc942a23c16 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: dns_internal.cc,v 1.5 1999/04/18 05:30:56 wessels Exp $
+ * $Id: dns_internal.cc,v 1.6 1999/04/18 05:44:55 wessels Exp $
  *
  * DEBUG: section 78    DNS lookups; interacts with lib/rfc1035.c
  * AUTHOR: Duane Wessels
@@ -42,6 +42,8 @@
 #define DOMAIN_PORT 53
 #endif
 
+#define IDNS_MAX_TRIES 20
+
 typedef struct _ns ns;
 struct _ns {
     struct sockaddr_in S;
@@ -297,7 +299,17 @@ idnsCheckQueue(void *unused)
        debug(78, 1) ("idnsCheckQueue: ID %#04x timeout\n",
            q->id);
        dlinkDelete(&q->lru, &lru_list);
-       idnsSendQuery(q);
+       if (q->nsends < IDNS_MAX_TRIES) {
+           idnsSendQuery(q);
+       } else {
+           int v = cbdataValid(q->callback_data);
+           debug(78, 1) ("idnsCheckQueue: ID %x: giving up after %d tries\n",
+               q->nsends);
+           cbdataUnlock(q->callback_data);
+           if (v)
+               q->callback(q->callback_data, NULL, 0);
+           memFree(q, MEM_IDNS_QUERY);
+       }
     }
 }