diff --git a/lib/ns/include/ns/client.h b/lib/ns/include/ns/client.h index bfb4f3a76d..2a27df8c20 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 1cf20c00b3..bdeeb13e70 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: