*\li 'resolver' to be valid.
*/
-unsigned int
-dns_resolver_nrunning(dns_resolver_t *resolver);
-/*%<
- * Return the number of currently running resolutions in this
- * resolver. This is may be less than the number of outstanding
- * fetches due to multiple identical fetches, or more than the
- * number of of outstanding fetches due to the fact that resolution
- * can continue even though a fetch has been canceled.
- */
-
isc_result_t
dns_resolver_addalternate(dns_resolver_t *resolver, const isc_sockaddr_t *alt,
const dns_name_t *name, in_port_t port);
dns_fetch_t * primefetch;
/* Atomic. */
- isc_refcount_t nfctx;
+ atomic_uint_fast32_t nfctx;
};
#define RES_MAGIC ISC_MAGIC('R', 'e', 's', '!')
ISC_LIST_UNLINK(res->buckets[bucketnum].fctxs, fctx, link);
- isc_refcount_decrement(&res->nfctx);
+ REQUIRE(atomic_fetch_sub_release(&res->nfctx, 1) > 0);
dec_stats(res, dns_resstatscounter_nfetch);
else
fctx_try(fctx, false, false);
} else if (dodestroy) {
- fctx_destroy(fctx);
+ fctx_destroy(fctx);
if (bucket_empty)
empty_bucket(res);
}
ISC_LIST_APPEND(res->buckets[bucketnum].fctxs, fctx, link);
- isc_refcount_increment(&res->nfctx);
+ REQUIRE(atomic_fetch_add_relaxed(&res->nfctx, 1) < UINT32_MAX);
inc_stats(res, dns_resstatscounter_nfetch);
fctx_increference(fetchctx_t *fctx) {
REQUIRE(VALID_FCTX(fctx));
- isc_refcount_increment(&fctx->references);
+ isc_refcount_increment0(&fctx->references);
}
/*
RTRACE("destroy");
- isc_refcount_destroy(&res->nfctx);
+ REQUIRE(atomic_load_acquire(&res->nfctx) == 0);
isc_mutex_destroy(&res->primelock);
isc_mutex_destroy(&res->lock);
res->priming = false;
res->primefetch = NULL;
- isc_refcount_init(&res->nfctx, 0);
+ atomic_init(&res->nfctx, 0);
isc_mutex_init(&res->lock);
isc_mutex_init(&res->primelock);
resolver->lame_ttl = lame_ttl;
}
-unsigned int
-dns_resolver_nrunning(dns_resolver_t *resolver) {
- return (isc_refcount_current(&resolver->nfctx));
-}
-
isc_result_t
dns_resolver_addalternate(dns_resolver_t *resolver, const isc_sockaddr_t *alt,
const dns_name_t *name, in_port_t port) {