]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
2487. [bug] Give TCP connections longer to complete. [RT #18675]
authorMark Andrews <marka@isc.org>
Fri, 7 Nov 2008 01:09:55 +0000 (01:09 +0000)
committerMark Andrews <marka@isc.org>
Fri, 7 Nov 2008 01:09:55 +0000 (01:09 +0000)
CHANGES
lib/dns/resolver.c

diff --git a/CHANGES b/CHANGES
index 8093cd8f49d5ff4870f4a6ba4f6f86b5a9801633..04e84747b6962d7db2d90c6e03cac5131cc5d754 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,5 @@
+2487.  [bug]           Give TCP connections longer to complete. [RT #18675]
+
 2485.  [bug]           Change update's the handling of obscured RRSIG
                        records.  Not all orphand DS records were being
                        removed. [RT #18828]
index 3f554aa401862739cb4f54ecbcac9a70414dc414..2d8f187fee97f01e8044e9d0afafc00852ad5263 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: resolver.c,v 1.355.12.27 2008/11/06 02:18:34 marka Exp $ */
+/* $Id: resolver.c,v 1.355.12.28 2008/11/07 01:09:55 marka Exp $ */
 
 /*! \file */
 
@@ -542,14 +542,13 @@ fctx_stoptimer(fetchctx_t *fctx) {
 
 
 static inline isc_result_t
-fctx_startidletimer(fetchctx_t *fctx) {
+fctx_startidletimer(fetchctx_t *fctx, isc_interval_t *interval) {
        /*
         * Start the idle timer for fctx.  The lifetime timer continues
         * to be in effect.
         */
        return (isc_timer_reset(fctx->timer, isc_timertype_once,
-                               &fctx->expires, &fctx->interval,
-                               ISC_FALSE));
+                               &fctx->expires, interval, ISC_FALSE));
 }
 
 /*
@@ -1152,7 +1151,7 @@ fctx_query(fetchctx_t *fctx, dns_adbaddrinfo_t *addrinfo,
        task = res->buckets[fctx->bucketnum].task;
 
        fctx_setretryinterval(fctx, addrinfo->srtt);
-       result = fctx_startidletimer(fctx);
+       result = fctx_startidletimer(fctx, &fctx->interval);
        if (result != ISC_R_SUCCESS)
                return (result);
 
@@ -1750,6 +1749,7 @@ resquery_connected(isc_task_t *task, isc_event_t *event) {
        isc_socketevent_t *sevent = (isc_socketevent_t *)event;
        resquery_t *query = event->ev_arg;
        isc_boolean_t retry = ISC_FALSE;
+       isc_interval_t interval;
        isc_result_t result;
        unsigned int attrs;
        fetchctx_t *fctx;
@@ -1782,6 +1782,20 @@ resquery_connected(isc_task_t *task, isc_event_t *event) {
        } else {
                switch (sevent->result) {
                case ISC_R_SUCCESS:
+
+                       /*
+                        * Extend the idle timer for TCP.  20 seconds
+                        * should be long enough for a TCP connection to be
+                        * established, a single DNS request to be sent,
+                        * and the response received.
+                        */
+                       isc_interval_set(&interval, 20, 0);
+                       result = fctx_startidletimer(query->fctx, &interval);
+                       if (result != ISC_R_SUCCESS) {
+                               fctx_cancelquery(&query, NULL, NULL, ISC_FALSE);
+                               fctx_done(fctx, result);
+                               break;
+                       }
                        /*
                         * We are connected.  Create a dispatcher and
                         * send the query.
@@ -1814,8 +1828,7 @@ resquery_connected(isc_task_t *task, isc_event_t *event) {
                                result = resquery_send(query);
 
                        if (result != ISC_R_SUCCESS) {
-                               fctx_cancelquery(&query, NULL, NULL,
-                                                ISC_FALSE);
+                               fctx_cancelquery(&query, NULL, NULL, ISC_FALSE);
                                fctx_done(fctx, result);
                        }
                        break;