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

Simplify when to detach the client

With stale-answer-client-timeout, we may send a response to the client,
but we may want to hold on to the network manager handle, because
recursion is going on in the background, or we need to refresh a
stale RRset.

Simplify the setting of 'nodetach':
* During a staleonly lookup we should not detach the nmhandle, so just
  set it prior to 'query_lookup()'.
* During a staleonly "stalefirst" lookup set the 'nodetach' to true
  if we are going to refresh the RRset.

Now there is no longer the need to clear the 'nodetach' if we go
through the "dbfind_stale", "stale_refresh_window", or "stale_only"
paths.
This commit is contained in:
Matthijs Mekking 2021-03-25 18:12:38 +01:00
parent 92f7a67892
commit 48b0dc159b

View File

@ -5786,7 +5786,6 @@ query_lookup(query_ctx_t *qctx) {
* active RRset is not available. * active RRset is not available.
*/ */
qctx->client->query.dboptions |= DNS_DBFIND_STALEONLY; qctx->client->query.dboptions |= DNS_DBFIND_STALEONLY;
qctx->client->nodetach = true;
} }
dboptions = qctx->client->query.dboptions; dboptions = qctx->client->query.dboptions;
@ -5891,7 +5890,6 @@ query_lookup(query_ctx_t *qctx) {
QUERY_ERROR(qctx, DNS_R_SERVFAIL); QUERY_ERROR(qctx, DNS_R_SERVFAIL);
return (ns_query_done(qctx)); return (ns_query_done(qctx));
} }
qctx->client->nodetach = false;
} else if (stale_refresh_window) { } else if (stale_refresh_window) {
/* /*
* A recent lookup failed, so during this time window we are * A recent lookup failed, so during this time window we are
@ -5911,15 +5909,7 @@ query_lookup(query_ctx_t *qctx) {
QUERY_ERROR(qctx, DNS_R_SERVFAIL); QUERY_ERROR(qctx, DNS_R_SERVFAIL);
return (ns_query_done(qctx)); return (ns_query_done(qctx));
} }
qctx->client->nodetach = false;
} else if (stale_only) { } else if (stale_only) {
/*
* This is a staleonly lookup: if there wass no stale answer
* in cache, treat as we don't have an answer and wait for the
* resolver fetch to finish.
*/
qctx->client->nodetach = !stale_found;
if ((qctx->options & DNS_GETDB_STALEFIRST) != 0) { if ((qctx->options & DNS_GETDB_STALEFIRST) != 0) {
if (!stale_found || result != ISC_R_SUCCESS) { if (!stale_found || result != ISC_R_SUCCESS) {
/* /*
@ -5952,6 +5942,7 @@ query_lookup(query_ctx_t *qctx) {
"refresh the RRset will still be made", "refresh the RRset will still be made",
namebuf); namebuf);
refresh_rrset = STALE(qctx->rdataset); refresh_rrset = STALE(qctx->rdataset);
qctx->client->nodetach = refresh_rrset;
} }
} else { } else {
/* /*