/*% Locked by appropriate bucket lock. */
fetchstate state;
- bool want_shutdown;
- bool cloned;
- bool spilled;
+ bool want_shutdown;
+ bool cloned;
+ bool spilled;
+ bool shuttingdown;
unsigned int references;
isc_event_t control_event;
ISC_LINK(struct fetchctx) link;
#define FCTX_ATTR_HAVEANSWER 0x0001
#define FCTX_ATTR_GLUING 0x0002
#define FCTX_ATTR_ADDRWAIT 0x0004
-#define FCTX_ATTR_SHUTTINGDOWN 0x0008
#define FCTX_ATTR_WANTCACHE 0x0010
#define FCTX_ATTR_WANTNCACHE 0x0020
#define FCTX_ATTR_NEEDEDNS0 0x0040
0)
#define ADDRWAIT(f) (((f)->attributes & FCTX_ATTR_ADDRWAIT) != \
0)
-#define SHUTTINGDOWN(f) (((f)->attributes & FCTX_ATTR_SHUTTINGDOWN) \
- != 0)
#define WANTCACHE(f) (((f)->attributes & FCTX_ATTR_WANTCACHE) != 0)
#define WANTNCACHE(f) (((f)->attributes & FCTX_ATTR_WANTNCACHE) != 0)
#define NEEDEDNS0(f) (((f)->attributes & FCTX_ATTR_NEEDEDNS0) != 0)
/*
* The fetch is waiting for a name to be found.
*/
- INSIST(!SHUTTINGDOWN(fctx));
+ INSIST(!fctx->shuttingdown);
if (event->ev_type == DNS_EVENT_ADBMOREADDRESSES) {
fctx->attributes &= ~FCTX_ATTR_ADDRWAIT;
want_try = true;
want_done = true;
}
}
- } else if (SHUTTINGDOWN(fctx) && fctx->pending == 0 &&
+ } else if (fctx->shuttingdown && fctx->pending == 0 &&
fctx->nqueries == 0 && ISC_LIST_EMPTY(fctx->validators)) {
if (fctx->references == 0) {
LOCK(&res->buckets[bucketnum].lock);
- fctx->attributes |= FCTX_ATTR_SHUTTINGDOWN;
+ fctx->shuttingdown = true;
INSIST(fctx->state == fetchstate_active ||
fctx->state == fetchstate_done);
* We haven't started this fctx yet, and we've been requested
* to shut it down.
*/
- fctx->attributes |= FCTX_ATTR_SHUTTINGDOWN;
+ fctx->shuttingdown = true;
fctx->state = fetchstate_done;
fctx_sendevents(fctx, ISC_R_CANCELED, __LINE__);
/*
fctx->logged = false;
fctx->attributes = 0;
fctx->spilled = false;
+ fctx->shuttingdown = false;
fctx->nqueries = 0;
fctx->reason = NULL;
fctx->rand_buf = 0;
dns_validator_t *validator, *next_validator;
bool dodestroy = false;
- REQUIRE(SHUTTINGDOWN(fctx));
-
bucketnum = fctx->bucketnum;
if (!locked)
LOCK(&res->buckets[bucketnum].lock);
+
+ REQUIRE(fctx->shuttingdown);
+
if (fctx->pending != 0 || fctx->nqueries != 0)
goto unlock;
* done waiting for validator completions and ADB pending events; if
* so, destroy the fctx.
*/
- if (SHUTTINGDOWN(fctx) && !sentresponse) {
+ if (fctx->shuttingdown && !sentresponse) {
bool bucket_empty;
bucket_empty = maybe_destroy(fctx, true);
UNLOCK(&res->buckets[bucketnum].lock);
* the data, destroy now.
*/
dns_db_detachnode(fctx->cache, &node);
- if (SHUTTINGDOWN(fctx))
+ if (fctx->shuttingdown) {
bucket_empty = maybe_destroy(fctx, true);
+ }
UNLOCK(&res->buckets[bucketnum].lock);
- if (bucket_empty)
+ if (bucket_empty) {
empty_bucket(res);
+ }
goto cleanup_event;
}
* No one cares about the result of this fetch anymore.
*/
if (fctx->pending == 0 && fctx->nqueries == 0 &&
- ISC_LIST_EMPTY(fctx->validators) && SHUTTINGDOWN(fctx)) {
+ ISC_LIST_EMPTY(fctx->validators) && fctx->shuttingdown)
+ {
/*
* This fctx is already shutdown; we were just
* waiting for the last reference to go away.