]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Clean up 'nodetach' in ns_client
authorAram Sargsyan <aram@isc.org>
Mon, 7 Oct 2024 15:29:14 +0000 (15:29 +0000)
committerArаm Sаrgsyаn <aram@isc.org>
Wed, 9 Oct 2024 08:03:13 +0000 (08:03 +0000)
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.

lib/ns/include/ns/client.h
lib/ns/query.c

index bfb4f3a76dc084154d2ac4074f15980549fb96a1..2a27df8c2085ae4af4373b66f5fb21ce686ded03 100644 (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;
index 1cf20c00b36c7e41e1c1e856426304ecf1926959..bdeeb13e7051e7ab7642cacb73224178bdaad284 100644 (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: