2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 14:07:59 +00:00

start work to allow a client to be cancelled/idled

This commit is contained in:
Bob Halley
1999-10-20 01:58:48 +00:00
parent 1646ae97bc
commit d3376f4cf5

View File

@@ -93,11 +93,12 @@ query_reset(ns_client_t *client, isc_boolean_t everything) {
*/ */
/* /*
* If there is an active fetch for this client, cancel it. * Cancel the fetch if it's running.
*/ */
if (client->query.fetch != NULL) { if (client->query.fetch != NULL) {
dns_resolver_destroyfetch(client->view->resolver, dns_resolver_cancelfetch(client->view->resolver,
&client->query.fetch); client->query.fetch);
client->query.fetch = NULL;
} }
/* /*
@@ -1261,6 +1262,7 @@ static void
query_resume(isc_task_t *task, isc_event_t *event) { query_resume(isc_task_t *task, isc_event_t *event) {
dns_fetchevent_t *devent = (dns_fetchevent_t *)event; dns_fetchevent_t *devent = (dns_fetchevent_t *)event;
ns_client_t *client; ns_client_t *client;
isc_boolean_t want_find;
/* /*
* Resume a query after recursion. * Resume a query after recursion.
@@ -1272,9 +1274,28 @@ query_resume(isc_task_t *task, isc_event_t *event) {
REQUIRE(task == client->task); REQUIRE(task == client->task);
REQUIRE(RECURSING(client)); REQUIRE(RECURSING(client));
if (devent->fetch == client->query.fetch) {
/*
* This is the fetch we've been waiting for.
*/
client->query.fetch = NULL;
want_find = ISC_TRUE;
} else {
/*
* This is a fetch completion event for a cancelled fetch.
* Clean up and don't resume the find.
*/
if (devent->node != NULL)
dns_db_detachnode(devent->db, &devent->node);
if (devent->db != NULL)
dns_db_detach(&devent->db);
query_putrdataset(client, &devent->rdataset);
query_putrdataset(client, &devent->sigrdataset);
want_find = ISC_FALSE;
}
client->query.attributes &= ~NS_QUERYATTR_RECURSING; client->query.attributes &= ~NS_QUERYATTR_RECURSING;
dns_resolver_destroyfetch(client->view->resolver, dns_resolver_destroyfetch(client->view->resolver, &devent->fetch);
&client->query.fetch);
client->waiting--; client->waiting--;
@@ -1289,7 +1310,8 @@ query_resume(isc_task_t *task, isc_event_t *event) {
* mode). * mode).
*/ */
query_find(client, devent); if (want_find)
query_find(client, devent);
} }
static isc_result_t static isc_result_t
@@ -1801,9 +1823,6 @@ query_find(ns_client_t *client, dns_fetchevent_t *event) {
ISC_LIST_APPEND(fname->list, rdataset, link); ISC_LIST_APPEND(fname->list, rdataset, link);
fname = NULL; fname = NULL;
rdataset = NULL; rdataset = NULL;
/*
* XXXRTH Deal with AD bit.
*/
goto cleanup; goto cleanup;
case DNS_R_CNAME: case DNS_R_CNAME:
/* /*
@@ -2041,12 +2060,6 @@ query_find(ns_client_t *client, dns_fetchevent_t *event) {
fname = NULL; fname = NULL;
} }
/*
* XXXRTH Handle additional questions above. Find all the question
* types we can from the node we found, and (if recursion is
* OK) launch queries for any types we don't have answers to.
*/
addauth: addauth:
/* /*
* Add NS records for the zone to the authority section (if we * Add NS records for the zone to the authority section (if we