cleanup:
dns_db_detach(&kfetch->db);
- /* The zone must be managed */
- INSIST(kfetch->zone->loop != NULL);
isc_refcount_decrement(&zone->irefs);
if (dns_rdataset_isassociated(keydataset)) {
isc_time_subtract(next, now, &interval);
}
- if (zone->timer == NULL) {
+ if (zone->loop == NULL) {
+ zone_debuglog(zone, __func__, 10, "zone is not managed");
+ } else if (zone->timer == NULL) {
isc_refcount_increment0(&zone->irefs);
isc_timer_create(zone->loop, zone_timer, zone, &zone->timer);
}
-
- isc_timer_start(zone->timer, isc_timertype_once, &interval);
+ if (zone->timer != NULL) {
+ isc_timer_start(zone->timer, isc_timertype_once, &interval);
+ }
}
static void
REQUIRE(zone->timer == NULL);
REQUIRE(zone->zmgr == NULL);
- zone->loop = isc_loop_get(zmgr->loopmgr, zone->tid);
+ isc_loop_t *loop = isc_loop_get(zmgr->loopmgr, zone->tid);
+ isc_loop_attach(loop, &zone->loop);
zonemgr_keymgmt_add(zmgr, zone, &zone->kfio);
INSIST(zone->kfio != NULL);
ENSURE(zone->kfio == NULL);
}
+ if (zone->timer != NULL) {
+ isc_refcount_decrement(&zone->irefs);
+ isc_timer_destroy(&zone->timer);
+ }
+
+ isc_loop_detach(&zone->loop);
+
/* Detach below, outside of the write lock. */
zone->zmgr = NULL;
}
cleanup:
- /* The zone must be managed */
- INSIST(nsfetch->zone->loop != NULL);
isc_refcount_decrement(&zone->irefs);
if (dns_rdataset_isassociated(nsrrset)) {
LOCK_ZONE(zone);
LOCK_ZONE(raw);
- raw->loop = zone->loop;
+ isc_loop_attach(zone->loop, &raw->loop);
/* dns_zone_attach(raw, &zone->raw); */
isc_refcount_increment(&raw->references);