chg: dev: Shutdown the fetch context after canceling the last fetch

Shutdown the fetch context immediately after the last fetch has been canceled from
that particular fetch context.

Merge branch 'ondrej/shutdown-the-fetch-context-early' into 'main'

See merge request isc-projects/bind9!9958
This commit is contained in:
Ondřej Surý
2025-01-22 13:21:23 +00:00
+9 -4
View File
@@ -10584,6 +10584,7 @@ fail:
void
dns_resolver_cancelfetch(dns_fetch_t *fetch) {
fetchctx_t *fctx = NULL;
bool last_fetch = false;
REQUIRE(DNS_FETCH_VALID(fetch));
fctx = fetch->private;
@@ -10614,11 +10615,15 @@ dns_resolver_cancelfetch(dns_fetch_t *fetch) {
}
}
/*
* The fctx continues running even if no fetches remain;
* the answer is still cached.
*/
if (ISC_LIST_EMPTY(fctx->resps)) {
last_fetch = true;
}
UNLOCK(&fctx->lock);
if (last_fetch) {
fetchctx_ref(fctx);
isc_async_run(fctx->loop, fctx_shutdown, fctx);
}
}
void