2487. [bug] Give TCP connections longer to complete. [RT #18675]

This commit is contained in:
Mark Andrews
2008-11-20 01:29:33 +00:00
parent a696315d19
commit fdf3321006
2 changed files with 22 additions and 7 deletions

View File

@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: resolver.c,v 1.284.18.80 2008/11/20 01:13:51 marka Exp $ */
/* $Id: resolver.c,v 1.284.18.81 2008/11/20 01:29:33 marka Exp $ */
/*! \file */
@@ -522,14 +522,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));
}
/*
@@ -1095,7 +1094,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);
@@ -1672,6 +1671,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;
@@ -1704,6 +1704,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.
@@ -1736,8 +1750,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;