return 0;
}
+// Returns the zone context for a given zone
+static zone_ctx* find_zone(dns_zone_t* z) {
+ for (unsigned int i = 0; i < ctx.num_zones; i++) {
+ if (ctx.zones[i].zone == z)
+ return &ctx.zones[i];
+ }
+
+ return NULL;
+}
+
static void maybe_shutdown(void) {
// Don't shut down if there is something left running
if (ctx.running)
isc_loopmgr_shutdown(ctx.loopmgr);
}
-static void zone_done(dns_zone_t* zone) {
+static void zone_done(dns_zone_t* z) {
+ // Fetch the zone
+ zone_ctx* zone = find_zone(z);
+ if (!zone)
+ return ;
+
// Release the zone from the manager
- dns_zonemgr_releasezone(ctx.zonemgr, zone);
+ dns_zonemgr_releasezone(ctx.zonemgr, zone->zone);
// Free the zone
- dns_zone_detach(&zone);
+ dns_zone_detach(&zone->zone);
// Decrement the number of running zones
ctx.running--;