mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 06:25:31 +00:00
Add recursionquota_detach()
Add a new helper function for detaching from the recursion quota in order to reduce code duplication and to ensure that detaching from that quota is always accompanied by decreasing the recursive clients counter.
This commit is contained in:
committed by
Michał Kępień
parent
fe1ac19194
commit
70254724e7
@@ -2477,6 +2477,16 @@ free_devent(ns_client_t *client, isc_event_t **eventp,
|
||||
isc_event_free(eventp);
|
||||
}
|
||||
|
||||
static void
|
||||
recursionquota_detach(ns_client_t *client) {
|
||||
if (client->recursionquota != NULL) {
|
||||
isc_quota_detach(&client->recursionquota);
|
||||
}
|
||||
|
||||
ns_stats_decrement(client->manager->sctx->nsstats,
|
||||
ns_statscounter_recursclients);
|
||||
}
|
||||
|
||||
static void
|
||||
prefetch_done(isc_task_t *task, isc_event_t *event) {
|
||||
dns_fetchevent_t *devent = (dns_fetchevent_t *)event;
|
||||
@@ -2501,12 +2511,7 @@ prefetch_done(isc_task_t *task, isc_event_t *event) {
|
||||
/*
|
||||
* We're done prefetching, detach from quota.
|
||||
*/
|
||||
if (client->recursionquota != NULL) {
|
||||
isc_quota_detach(&client->recursionquota);
|
||||
}
|
||||
|
||||
ns_stats_decrement(client->manager->sctx->nsstats,
|
||||
ns_statscounter_recursclients);
|
||||
recursionquota_detach(client);
|
||||
|
||||
free_devent(client, &event, &devent);
|
||||
isc_nmhandle_detach(&client->prefetchhandle);
|
||||
@@ -6181,12 +6186,7 @@ fetch_callback(isc_task_t *task, isc_event_t *event) {
|
||||
* the manager's recursing-clients list.
|
||||
*/
|
||||
|
||||
if (client->recursionquota != NULL) {
|
||||
isc_quota_detach(&client->recursionquota);
|
||||
}
|
||||
|
||||
ns_stats_decrement(client->manager->sctx->nsstats,
|
||||
ns_statscounter_recursclients);
|
||||
recursionquota_detach(client);
|
||||
|
||||
LOCK(&client->manager->reclock);
|
||||
if (ISC_LINK_LINKED(client, rlink)) {
|
||||
@@ -6674,12 +6674,7 @@ query_hookresume(isc_task_t *task, isc_event_t *event) {
|
||||
UNLOCK(&client->query.fetchlock);
|
||||
SAVE(hctx, rev->ctx);
|
||||
|
||||
if (client->recursionquota != NULL) {
|
||||
isc_quota_detach(&client->recursionquota);
|
||||
}
|
||||
|
||||
ns_stats_decrement(client->manager->sctx->nsstats,
|
||||
ns_statscounter_recursclients);
|
||||
recursionquota_detach(client);
|
||||
|
||||
LOCK(&client->manager->reclock);
|
||||
if (ISC_LINK_LINKED(client, rlink)) {
|
||||
|
Reference in New Issue
Block a user