*/
if (client->recursionquota != NULL) {
isc_quota_detach(&client->recursionquota);
+ ns_stats_decrement(client->sctx->nsstats,
+ ns_statscounter_recursclients);
}
free_devent(client, &event, &devent);
if (client->recursionquota == NULL) {
result = isc_quota_attach(&client->sctx->recursionquota,
&client->recursionquota);
- if (result == ISC_R_SOFTQUOTA) {
+ switch (result) {
+ case ISC_R_SUCCESS:
+ ns_stats_increment(client->sctx->nsstats,
+ ns_statscounter_recursclients);
+ break;
+ case ISC_R_SOFTQUOTA:
isc_quota_detach(&client->recursionquota);
- }
- if (result != ISC_R_SUCCESS) {
+ /* FALLTHROUGH */
+ default:
return;
}
}
if (client->recursionquota == NULL) {
result = isc_quota_attach(&client->sctx->recursionquota,
&client->recursionquota);
- if (result == ISC_R_SOFTQUOTA) {
+ switch (result) {
+ case ISC_R_SUCCESS:
+ ns_stats_increment(client->sctx->nsstats,
+ ns_statscounter_recursclients);
+ break;
+ case ISC_R_SOFTQUOTA:
isc_quota_detach(&client->recursionquota);
- }
- if (result != ISC_R_SUCCESS) {
+ /* FALLTHROUGH */
+ default:
return;
}
}
isc_quota_detach(&client->recursionquota);
ns_stats_decrement(client->sctx->nsstats,
ns_statscounter_recursclients);
- } else if (client->attributes & NS_CLIENTATTR_RECURSING) {
- client->attributes &= ~NS_CLIENTATTR_RECURSING;
- /*
- * Detached from recursionquota via prefetch_done(),
- * but need to decrement recursive client stats here anyway,
- * since it was incremented in ns_query_recurse().
- */
- ns_stats_decrement(client->sctx->nsstats,
- ns_statscounter_recursclients);
}
LOCK(&client->manager->reclock);
if (result == ISC_R_SUCCESS || result == ISC_R_SOFTQUOTA) {
ns_stats_increment(client->sctx->nsstats,
ns_statscounter_recursclients);
- client->attributes |= NS_CLIENTATTR_RECURSING;
}
if (result == ISC_R_SOFTQUOTA) {
dns_message_clonebuffer(client->message);
ns_client_recursing(client);
- } else if ((client->attributes & NS_CLIENTATTR_RECURSING) == 0) {
- client->attributes |= NS_CLIENTATTR_RECURSING;
- /*
- * query_prefetch() attached first to client->recursionquota,
- * but we must check if NS_CLIENTATTR_RECURSING attribute is
- * on, if not then turn it on and increment recursing clients
- * stats counter only once. The attribute is also checked in
- * fetch_callback() to know if a matching decrement to this
- * counter should be applied.
- */
- ns_stats_increment(client->sctx->nsstats,
- ns_statscounter_recursclients);
}
/*