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

Try next server on resolver timeout

Instead of resending to the same server on the (dispatch) timeout in the
resolver, try the next server.
This commit is contained in:
Ondřej Surý 2022-12-12 12:06:01 +01:00
parent d0d4a7ede7
commit 5466a48fc9
No known key found for this signature in database
GPG Key ID: 2820F37E873DEA41

View File

@ -8041,19 +8041,16 @@ rctx_timedout(respctx_t *rctx) {
isc_time_now(&now); isc_time_now(&now);
/* netmgr timeouts are accurate to the millisecond */ /* netmgr timeouts are accurate to the millisecond */
if (isc_time_microdiff(&fctx->expires, &now) < US_PER_MS) { if (isc_time_microdiff(&fctx->expires, &now) < US_PER_MS) {
FCTXTRACE("stopped trying to make fetch happen"); FCTXTRACE("query timed out; stopped trying to make "
"fetch happen");
} else { } else {
FCTXTRACE("query timed out; no response"); FCTXTRACE("query timed out; trying next server");
/* try next server */
rctx->no_response = true; rctx->no_response = true;
rctx->finish = NULL; rctx->finish = NULL;
if (!ISFORWARDER(rctx->query->addrinfo) || rctx->next_server = true;
fctx->fwdpolicy != dns_fwdpolicy_first)
{
rctx->resend = true;
}
} }
FCTXTRACE("timed out");
rctx_done(rctx, rctx->result); rctx_done(rctx, rctx->result);
return (ISC_R_COMPLETE); return (ISC_R_COMPLETE);
} }
@ -9759,10 +9756,11 @@ rctx_done(respctx_t *rctx, isc_result_t result) {
fctx_cancelquery(&query, rctx->finish, rctx->no_response, false); fctx_cancelquery(&query, rctx->finish, rctx->no_response, false);
/* /*
* If nobody's waiting for results, don't resend. * If nobody's waiting for results, don't resend or try next server.
*/ */
LOCK(&fctx->lock); LOCK(&fctx->lock);
if (ISC_LIST_EMPTY(fctx->events)) { if (ISC_LIST_EMPTY(fctx->events)) {
rctx->next_server = false;
rctx->resend = false; rctx->resend = false;
} }
UNLOCK(&fctx->lock); UNLOCK(&fctx->lock);