return;
}
+ tmprdataset = ns_client_newrdataset(client);
+ if (tmprdataset == NULL) {
+ return;
+ }
+
if (client->recursionquota == NULL) {
result = isc_quota_attach(&client->sctx->recursionquota,
&client->recursionquota);
isc_quota_detach(&client->recursionquota);
FALLTHROUGH;
default:
+ ns_client_putrdataset(client, &tmprdataset);
return;
}
}
- tmprdataset = ns_client_newrdataset(client);
- if (tmprdataset == NULL) {
- return;
- }
-
if (!TCP(client)) {
peeraddr = &client->peeraddr;
} else {
prefetch_done, client, tmprdataset, NULL,
&client->query.prefetch);
if (result != ISC_R_SUCCESS) {
+ if (client->recursionquota != NULL) {
+ isc_quota_detach(&client->recursionquota);
+ ns_stats_decrement(client->sctx->nsstats,
+ ns_statscounter_recursclients);
+ }
+
ns_client_putrdataset(client, &tmprdataset);
isc_nmhandle_detach(&client->prefetchhandle);
}
return;
}
+ tmprdataset = ns_client_newrdataset(client);
+ if (tmprdataset == NULL) {
+ return;
+ }
+
if (client->recursionquota == NULL) {
result = isc_quota_attach(&client->sctx->recursionquota,
&client->recursionquota);
isc_quota_detach(&client->recursionquota);
FALLTHROUGH;
default:
+ ns_client_putrdataset(client, &tmprdataset);
return;
}
}
- tmprdataset = ns_client_newrdataset(client);
- if (tmprdataset == NULL) {
- return;
- }
-
if (!TCP(client)) {
peeraddr = &client->peeraddr;
} else {
prefetch_done, client, tmprdataset, NULL,
&client->query.prefetch);
if (result != ISC_R_SUCCESS) {
+ if (client->recursionquota != NULL) {
+ isc_quota_detach(&client->recursionquota);
+ ns_stats_decrement(client->sctx->nsstats,
+ ns_statscounter_recursclients);
+ }
+
ns_client_putrdataset(client, &tmprdataset);
isc_nmhandle_detach(&client->prefetchhandle);
}
0, NULL, client->task, fetch_callback, client, rdataset,
sigrdataset, &client->query.fetch);
if (result != ISC_R_SUCCESS) {
- isc_nmhandle_detach(&client->fetchhandle);
+ if (client->recursionquota != NULL) {
+ isc_quota_detach(&client->recursionquota);
+ ns_stats_decrement(client->sctx->nsstats,
+ ns_statscounter_recursclients);
+ }
+
+ LOCK(&client->manager->reclock);
+ if (ISC_LINK_LINKED(client, rlink)) {
+ ISC_LIST_UNLINK(client->manager->recursing, client,
+ rlink);
+ }
+ UNLOCK(&client->manager->reclock);
+
ns_client_putrdataset(client, &rdataset);
if (sigrdataset != NULL) {
ns_client_putrdataset(client, &sigrdataset);
}
+
+ isc_nmhandle_detach(&client->fetchhandle);
}
/*
result = runasync(saved_qctx, client->mctx, arg, client->task,
query_hookresume, client, &client->query.hookactx);
if (result != ISC_R_SUCCESS) {
- goto cleanup;
+ goto cleanup_and_detach_from_quota;
}
/*
isc_nmhandle_attach(client->handle, &client->fetchhandle);
return ISC_R_SUCCESS;
+cleanup_and_detach_from_quota:
+ if (client->recursionquota != NULL) {
+ isc_quota_detach(&client->recursionquota);
+ ns_stats_decrement(client->sctx->nsstats,
+ ns_statscounter_recursclients);
+ }
+
+ LOCK(&client->manager->reclock);
+ if (ISC_LINK_LINKED(client, rlink)) {
+ ISC_LIST_UNLINK(client->manager->recursing, client, rlink);
+ }
+ UNLOCK(&client->manager->reclock);
cleanup:
/*
* If we fail, send SERVFAIL now. It may be better to let the caller