INSIST(listener->exiting);
INSIST(ISC_LIST_EMPTY(listener->connections));
- isc_refcount_destroy(&listener->references);
-
REQUIRE(listener->sock == NULL);
free_controlkeylist(&listener->keys, listener->mctx);
}
isc_mutex_destroy(&entry->lock);
- isc_refcount_destroy(&entry->references);
isc_mem_put(adb->mctx, entry, sizeof(*entry));
dec_adbstats(adb, dns_adbstats_entriescnt);
isc_mem_detach(&adb->hmctx);
isc_mutex_destroy(&adb->lock);
- isc_refcount_destroy(&adb->references);
isc_stats_detach(&adb->stats);
dns_resolver_detach(&adb->res);
dns_catz_options_free(&catz->zoneoptions, mctx);
dns_catz_zones_detach(&catz->catzs);
- isc_refcount_destroy(&catz->references);
isc_mem_put(mctx, catz, sizeof(*catz));
}
catzs->magic = 0;
isc_mutex_destroy(&catzs->lock);
- isc_refcount_destroy(&catzs->references);
isc_mem_putanddetach(&catzs->mctx, catzs, sizeof(*catzs));
}
INSIST(disp->requests > 0);
disp->requests--;
- isc_refcount_destroy(&resp->references);
-
resp->magic = 0;
INSIST(!ISC_LINK_LINKED(resp, plink));
dns_dispatchmgr_t *mgr = disp->mgr;
uint32_t tid = isc_tid();
- isc_refcount_destroy(&disp->references);
disp->magic = 0;
if (disp->socktype == isc_socktype_tcp) {
destroy_keynode(dns_keynode_t *knode) {
dns_rdata_t *rdata = NULL;
- isc_refcount_destroy(&knode->references);
isc_rwlock_destroy(&knode->rwlock);
if (knode->dslist != NULL) {
for (rdata = ISC_LIST_HEAD(knode->dslist->rdata); rdata != NULL;
dns_qpread_destroy(keytable->table, &qpr);
dns_qpmulti_destroy(&keytable->table);
- isc_refcount_destroy(&keytable->references);
isc_mem_putanddetach(&keytable->mctx, keytable, sizeof(*keytable));
}
static void
destroy_ntnode(dns_ntnode_t *node) {
- isc_refcount_destroy(&node->references);
if (node->bits != NULL) {
isc_mem_cput(node->mctx, node->bits, node->bits[0],
sizeof(char));
/* dns_qpread_destroy(nametree->table, &qpr); */
dns_qpmulti_destroy(&nametree->table);
- isc_refcount_destroy(&nametree->references);
isc_mem_putanddetach(&nametree->mctx, nametree, sizeof(*nametree));
}
REQUIRE(nta->timer == NULL);
nta->magic = 0;
- isc_refcount_destroy(&nta->references);
if (dns_rdataset_isassociated(&nta->rdataset)) {
dns_rdataset_disassociate(&nta->rdataset);
}
static void
dns__ntatable_destroy(dns_ntatable_t *ntatable) {
- isc_refcount_destroy(&ntatable->references);
ntatable->magic = 0;
isc_rwlock_destroy(&ntatable->rwlock);
dns_qpmulti_destroy(&ntatable->table);
INSIST(atomic_load(&requestmgr->shuttingdown));
- isc_refcount_destroy(&requestmgr->references);
-
size_t nloops = isc_loopmgr_nloops(requestmgr->loopmgr);
for (size_t i = 0; i < nloops; i++) {
INSIST(ISC_LIST_EMPTY(requestmgr->requests[i]));
req_log(ISC_LOG_DEBUG(3), "%s: request %p", __func__, request);
- isc_refcount_destroy(&request->references);
-
/*
* These should have been cleaned up before the
* completion event was sent.
dns_dispatch_detach(&query->dispatch);
}
- isc_refcount_destroy(&query->references);
-
LOCK(&fctx->lock);
atomic_fetch_sub_release(&fctx->nqueries, 1);
UNLOCK(&fctx->lock);
FCTXTRACE("destroy");
- isc_refcount_destroy(&fctx->references);
-
fctx->magic = 0;
res = fctx->res;
dns_resolver__destroy(dns_resolver_t *res) {
alternate_t *a = NULL;
- isc_refcount_destroy(&res->references);
REQUIRE(!atomic_load_acquire(&res->priming));
REQUIRE(res->primefetch == NULL);
dns__rpz_zones_destroy(dns_rpz_zones_t *rpzs) {
REQUIRE(rpzs->shuttingdown);
- isc_refcount_destroy(&rpzs->references);
-
for (dns_rpz_num_t rpz_num = 0; rpz_num < DNS_RPZ_MAX_ZONES; ++rpz_num)
{
if (rpzs->zones[rpz_num] == NULL) {
ring->magic = 0;
- isc_refcount_destroy(&ring->references);
isc_rwlock_destroy(&ring->lock);
isc_mem_putanddetach(&ring->mctx, ring, sizeof(dns_tsigkeyring_t));
}
/* Safe-guards */
REQUIRE(atomic_load(&xfr->shuttingdown));
- isc_refcount_destroy(&xfr->references);
INSIST(xfr->shutdown_result != ISC_R_UNSET);
static void
zone_destroy(dns_zone_t *zone) {
- isc_refcount_destroy(&zone->references);
-
/*
* Stop things being restarted after we cancel them below.
*/
typedef atomic_uint_fast32_t isc_refcount_t;
+#define ISC_REFCOUNT_INITIALIZER(a) (a)
+
/** \def isc_refcount_init(ref, n)
* \brief Initialize the reference counter.
* \param[in] ref pointer to reference counter.
uint_fast32_t refs = \
isc_refcount_decrement(&ptr->references) - 1; \
if (refs == 0) { \
+ isc_refcount_destroy(&ptr->references); \
destroy(ptr); \
} \
fprintf(stderr, \
uint_fast32_t refs = \
isc_refcount_decrement(&ptr->references) - 1; \
if (refs == 0) { \
+ isc_refcount_destroy(&ptr->references); \
destroy(ptr); \
} \
fprintf(stderr, \
void name##_unref(name##_t *ptr) { \
REQUIRE(ptr != NULL); \
if (isc_refcount_decrement(&ptr->references) == 1) { \
+ isc_refcount_destroy(&ptr->references); \
destroy(ptr); \
} \
} \
static void
nmhandle_free(isc_nmsocket_t *sock, isc_nmhandle_t *handle) {
- isc_refcount_destroy(&handle->references);
-
handle->magic = 0;
if (handle->dofree != NULL) {
static void
ratelimiter_destroy(isc_ratelimiter_t *restrict rl) {
- isc_refcount_destroy(&rl->references);
-
LOCK(&rl->lock);
REQUIRE(rl->state == isc_ratelimiter_shuttingdown);
UNLOCK(&rl->lock);
manager->magic = 0;
- isc_refcount_destroy(&manager->references);
-
isc_loop_detach(&manager->loop);
dns_aclenv_detach(&manager->aclenv);