[MERGE] bug 2393: DNS queue management

From: Amos Jeffries <squid3_at_treenet.co.nz>
Date: Sun, 28 Sep 2008 23:10:04 +1300

Updated on what is in bugzilla.

Amos

# Bazaar merge directive format 2 (Bazaar 0.90)
# revision_id: squid3_at_treenet.co.nz-20080928100257-z0axg3hw2azr2axc
# target_branch: http://www.squid-cache.org/bzr/squid3/trunk/
# testament_sha1: 344a58d90eab4410e5109082181e9fbe43cf0189
# timestamp: 2008-09-28 22:06:19 +1200
# source_branch: http://www.squid-cache.org/bzr/squid3/trunk/
# base_revision_id: rousskov_at_measurement-factory.com-20080925172758-\
# r45lxgfhq0scvbp0
#
# Begin patch
=== modified file 'src/dns_internal.cc'
--- src/dns_internal.cc 2008-07-12 15:40:56 +0000
+++ src/dns_internal.cc 2008-09-28 10:02:57 +0000
@@ -105,8 +105,8 @@
     int need_vc;
 
     struct timeval start_t;
-
     struct timeval sent_t;
+ struct timeval queue_t;
     dlink_node lru;
     IDNSCB *callback;
     void *callback_data;
@@ -823,7 +823,7 @@
 
         q->nsends++;
 
- q->sent_t = current_time;
+ q->queue_t = q->sent_t = current_time;
 
         if (x < 0)
             debugs(50, 1, "idnsSendQuery: FD " << DnsSocket << ": sendto: " << xstrerror());
@@ -836,6 +836,7 @@
     }
 
     nameservers[ns].nqueries++;
+ q->queue_t = current_time;
     dlinkAdd(q, &q->lru, &lru_list);
     idnsTickleQueue();
 }
@@ -1197,20 +1198,29 @@
     idns_query *q;
     event_queued = 0;
 
+ if (0 == nns)
+ /* name servers went away; reconfiguring or shutting down */
+ return;
+
     for (n = lru_list.tail; n; n = p) {
- if (0 == nns)
- /* name servers went away; reconfiguring or shutting down */
- break;
-
- q = (idns_query *)n->data;
-
- if (tvSubDsec(q->sent_t, current_time) < Config.Timeout.idns_retransmit * (1 << (q->nsends - 1) % nns))
- break;
+
+ p = n->prev;
+ q = n->data;
+
+ /* Anything to process in the queue? */
+ if (tvSubDsec(q->queue_t, current_time) < Config.Timeout.idns_retransmit )
+ break;
+
+ /* Query timer expired? */
+ if (tvSubDsec(q->sent_t, current_time) < Config.Timeout.idns_retransmit * 1 << ((q->nsends - 1) / nns)) {
+ dlinkDelete(&q->lru, &lru_list);
+ q->queue_t = current_time;
+ dlinkAdd(q, &q->lru, &lru_list);
+ continue;
+ }
 
         debugs(78, 3, "idnsCheckQueue: ID 0x" << std::hex << std::setfill('0') << std::setw(4) << q->id << "timeout" );
 
- p = n->prev;
-
         dlinkDelete(&q->lru, &lru_list);
 
         if (tvSubDsec(q->start_t, current_time) < Config.Timeout.idns_query) {

# Begin bundle
IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWQyAr2sAA5bfgERwUXf///4w
LAC/7//6YAbfCgAAAAAAAQ1KPFNPUxMQ0MgZNB6gGRkAPUYg5hMAmAEwmE0wAACZNNAxzCYBMAJh
MJpgAAEyaaBjmEwCYATCYTTAAAJk00DHMJgEwAmEwmmAAATJpoGEkgmgmAQ0CGRiTE0aKeozUzIn
p6paImSDatJsz18COj3ePP3+W1m/JuNVLikfuHUQe5e7VCgDCiMVp8nkAgy4MkVYds/bgTD5Yzzu
fkIJmBBm5AcD8jcvtUx/R0P5ll3BuLhhmAZo/dLVfTMaDw5vzY1tM5w+VE5AYI5wzePipWkqF+fy
6Zl0WxV7nyq7Oh8biefiArCKQwpowQGqwKCpXXMGzsfUnO8YIScF9Ti1ios2dvZn52HiQPA7S+Hm
0JZyc/uNSE99RtIJB7nkj6bHKp849Y3aJGMNRNvTK074D6Rf4GfJXAHQtEcKUzCwqW4/RMsw6+SW
2FhyFQIOKY7xBs8Fq+iYNefiI00zuc6wRyJ0B2/CA9hGQwjuANLwRI2g8iJjSEYByJbSeZnjmmnQ
hx9oJBEH8Bfo3HmWnpUcuKrMEr2ScDYPdaAfdyMLwvB58CcHK5jzPKMraMxyoKjEJgdS3Or9p9RZ
aFq0MZ0VHxvKXhP3HyFM+8LzSX35EwxOTW6GeTzBYPBDi8g6YYZNqLBw8JHUu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