From: Aram Sargsyan Date: Mon, 7 Oct 2024 15:29:14 +0000 (+0000) Subject: Clean up 'nodetach' in ns_client X-Git-Tag: v9.21.3~94^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b8c068835e733b4eef129116dff81ab0183f6d0d;p=thirdparty%2Fbind9.git 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. --- diff --git a/lib/ns/include/ns/client.h b/lib/ns/include/ns/client.h index bfb4f3a76dc..2a27df8c208 100644 --- a/lib/ns/include/ns/client.h +++ b/lib/ns/include/ns/client.h @@ -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; diff --git a/lib/ns/query.c b/lib/ns/query.c index 1cf20c00b36..bdeeb13e705 100644 --- a/lib/ns/query.c +++ b/lib/ns/query.c @@ -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: