* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: resolver.c,v 1.384.14.35 2011/11/02 23:48:41 marka Exp $ */
+/* $Id: resolver.c,v 1.384.14.36 2011/11/15 21:46:42 each Exp $ */
/*! \file */
dns_rdataset_t *ardataset,
isc_result_t *eresultp);
static void validated(isc_task_t *task, isc_event_t *event);
-static void maybe_destroy(fetchctx_t *fctx);
+static void maybe_destroy(fetchctx_t *fctx, isc_boolean_t locked);
static void add_bad(fetchctx_t *fctx, dns_adbaddrinfo_t *addrinfo,
isc_result_t reason, badnstype_t badtype);
query->fctx->nqueries--;
if (SHUTTINGDOWN(query->fctx))
- maybe_destroy(query->fctx); /* Locks bucket. */
+ maybe_destroy(query->fctx, ISC_FALSE); /* Locks bucket. */
query->magic = 0;
isc_mem_put(query->mctx, query, sizeof(*query));
*queryp = NULL;
* '*fctx' is shutting down.
*/
static void
-maybe_destroy(fetchctx_t *fctx) {
+maybe_destroy(fetchctx_t *fctx, isc_boolean_t locked) {
unsigned int bucketnum;
isc_boolean_t bucket_empty = ISC_FALSE;
dns_resolver_t *res = fctx->res;
}
bucketnum = fctx->bucketnum;
- LOCK(&res->buckets[bucketnum].lock);
+ if (!locked)
+ LOCK(&res->buckets[bucketnum].lock);
if (fctx->references == 0 && ISC_LIST_EMPTY(fctx->validators))
bucket_empty = fctx_destroy(fctx);
- UNLOCK(&res->buckets[bucketnum].lock);
+ if (!locked)
+ UNLOCK(&res->buckets[bucketnum].lock);
if (bucket_empty)
empty_bucket(res);
FCTXTRACE("received validation completion event");
+ LOCK(&fctx->res->buckets[fctx->bucketnum].lock);
+
ISC_LIST_UNLINK(fctx->validators, vevent->validator, link);
fctx->validator = NULL;
* so, destroy the fctx.
*/
if (SHUTTINGDOWN(fctx) && !sentresponse) {
- maybe_destroy(fctx); /* Locks bucket. */
+ maybe_destroy(fctx, ISC_TRUE);
+ UNLOCK(&fctx->res->buckets[fctx->bucketnum].lock);
goto cleanup_event;
}
- LOCK(&fctx->res->buckets[fctx->bucketnum].lock);
-
isc_stdtime_get(&now);
/*
dns_db_detachnode(fctx->cache, &node);
UNLOCK(&fctx->res->buckets[fctx->bucketnum].lock);
if (SHUTTINGDOWN(fctx))
- maybe_destroy(fctx); /* Locks bucket. */
+ maybe_destroy(fctx, ISC_FALSE); /* Locks bucket. */
goto cleanup_event;
}
dns_db_detachnode(fctx->cache, &node);
UNLOCK(&fctx->res->buckets[fctx->bucketnum].lock);
-
fctx_done(fctx, result, __LINE__); /* Locks bucket. */
cleanup_event: