2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-29 05:28:00 +00:00

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

This commit is contained in:
Mark Andrews 2008-11-07 00:52:34 +00:00
parent 7f950d7cb7
commit 09b45f7b58
2 changed files with 22 additions and 7 deletions

View File

@ -1,3 +1,5 @@
2487. [bug] Give TCP connections longer to complete. [RT #18675]
2486. [func] The default locations for named.pid and lwresd.pid 2486. [func] The default locations for named.pid and lwresd.pid
are now /var/run/named/named.pid and are now /var/run/named/named.pid and
/var/run/lwresd/lwresd.pid respectively. /var/run/lwresd/lwresd.pid respectively.

View File

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE. * PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: resolver.c,v 1.383 2008/11/06 02:20:14 marka Exp $ */ /* $Id: resolver.c,v 1.384 2008/11/07 00:52:34 marka Exp $ */
/*! \file */ /*! \file */
@ -552,14 +552,13 @@ fctx_stoptimer(fetchctx_t *fctx) {
static inline isc_result_t 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 * Start the idle timer for fctx. The lifetime timer continues
* to be in effect. * to be in effect.
*/ */
return (isc_timer_reset(fctx->timer, isc_timertype_once, return (isc_timer_reset(fctx->timer, isc_timertype_once,
&fctx->expires, &fctx->interval, &fctx->expires, interval, ISC_FALSE));
ISC_FALSE));
} }
/* /*
@ -1173,7 +1172,7 @@ fctx_query(fetchctx_t *fctx, dns_adbaddrinfo_t *addrinfo,
srtt = 1000000; srtt = 1000000;
fctx_setretryinterval(fctx, srtt); fctx_setretryinterval(fctx, srtt);
result = fctx_startidletimer(fctx); result = fctx_startidletimer(fctx, &fctx->interval);
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
return (result); return (result);
@ -1771,6 +1770,7 @@ resquery_connected(isc_task_t *task, isc_event_t *event) {
isc_socketevent_t *sevent = (isc_socketevent_t *)event; isc_socketevent_t *sevent = (isc_socketevent_t *)event;
resquery_t *query = event->ev_arg; resquery_t *query = event->ev_arg;
isc_boolean_t retry = ISC_FALSE; isc_boolean_t retry = ISC_FALSE;
isc_interval_t interval;
isc_result_t result; isc_result_t result;
unsigned int attrs; unsigned int attrs;
fetchctx_t *fctx; fetchctx_t *fctx;
@ -1803,6 +1803,20 @@ resquery_connected(isc_task_t *task, isc_event_t *event) {
} else { } else {
switch (sevent->result) { switch (sevent->result) {
case ISC_R_SUCCESS: 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 * We are connected. Create a dispatcher and
* send the query. * send the query.
@ -1835,8 +1849,7 @@ resquery_connected(isc_task_t *task, isc_event_t *event) {
result = resquery_send(query); result = resquery_send(query);
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
fctx_cancelquery(&query, NULL, NULL, fctx_cancelquery(&query, NULL, NULL, ISC_FALSE);
ISC_FALSE);
fctx_done(fctx, result); fctx_done(fctx, result);
} }
break; break;