fix: dev: Clean up 'nodetach' in ns_client

The 'nodetach' member is a leftover from the times when non-zero
'stale-answer-client-timeout' values were supported, and currently
is always 'false'. Clean up the member and its usage.

Merge branch 'aram/cleanup-ns-client-nodetach' into 'main'

See merge request isc-projects/bind9!9592
This commit is contained in:
Arаm Sаrgsyаn 2024-10-09 09:12:45 +00:00
commit 617381f115
2 changed files with 7 additions and 22 deletions

View file

@ -166,7 +166,6 @@ struct ns_client {
unsigned int magic;
ns_clientmgr_t *manager;
ns_clientstate_t state;
bool nodetach;
bool async;
unsigned int attributes;
dns_view_t *view;

View file

@ -666,9 +666,7 @@ query_send(ns_client_t *client) {
log_response(client, client->message->rcode);
}
if (!client->nodetach) {
isc_nmhandle_detach(&client->reqhandle);
}
isc_nmhandle_detach(&client->reqhandle);
}
static void
@ -704,9 +702,7 @@ query_error(ns_client_t *client, isc_result_t result, int line) {
log_response(client, rcode);
}
if (!client->nodetach) {
isc_nmhandle_detach(&client->reqhandle);
}
isc_nmhandle_detach(&client->reqhandle);
}
static void
@ -719,10 +715,7 @@ query_next(ns_client_t *client, isc_result_t result) {
inc_stats(client, ns_statscounter_failure);
}
ns_client_drop(client, result);
if (!client->nodetach) {
isc_nmhandle_detach(&client->reqhandle);
}
isc_nmhandle_detach(&client->reqhandle);
}
static void
@ -5144,7 +5137,7 @@ qctx_freedata(query_ctx_t *qctx) {
qctx->zversion = NULL;
}
if (qctx->fresp != NULL && !qctx->client->nodetach) {
if (qctx->fresp != NULL) {
free_fresp(qctx->client, &qctx->fresp);
}
}
@ -5973,7 +5966,6 @@ fetch_callback(void *arg) {
client->query.attributes |= NS_QUERYATTR_RECURSIONOK;
}
client->query.dboptions &= ~DNS_DBFIND_STALETIMEOUT;
client->nodetach = false;
LOCK(&client->query.fetchlock);
INSIST(FETCH_RECTYPE_NORMAL(client) == resp->fetch ||
@ -11294,7 +11286,7 @@ isc_result_t
ns_query_done(query_ctx_t *qctx) {
isc_result_t result = ISC_R_UNSET;
const dns_namelist_t *secs = qctx->client->message->sections;
bool nodetach, partial_result_with_servfail = false;
bool partial_result_with_servfail = false;
CCTRACE(ISC_LOG_DEBUG(3), "ns_query_done");
@ -11435,11 +11427,6 @@ ns_query_done(query_ctx_t *qctx) {
CALL_HOOK(NS_QUERY_DONE_SEND, qctx);
/*
* Client may have been detached after query_send(), so
* we test and store the flag state here, for safety.
*/
nodetach = qctx->client->nodetach;
query_send(qctx->client);
if (qctx->refresh_rrset) {
@ -11456,9 +11443,8 @@ ns_query_done(query_ctx_t *qctx) {
query_stale_refresh(qctx->client);
}
if (!nodetach) {
qctx->detach_client = true;
}
qctx->detach_client = true;
return (qctx->result);
cleanup: