Commit b36fcff1 authored by Jan Včelák's avatar Jan Včelák 🚀

zone: zone expiration is now stateful, no flag needed

parent 880ae32a
......@@ -240,7 +240,7 @@ static int zone_reload(zone_t *zone, ctl_args_t *args)
{
UNUSED(args);
if (zone->flags & ZONE_EXPIRED) {
if (zone_expired(zone)) {
return KNOT_ENOTSUP;
}
......
......@@ -104,7 +104,6 @@ int event_dnssec(conf_t *conf, zone_t *zone)
/* Switch zone contents. */
zone_contents_t *old_contents = zone_switch_contents(zone, new_contents);
zone->flags &= ~ZONE_EXPIRED;
synchronize_rcu();
update_free_zone(&old_contents);
......
......@@ -29,7 +29,6 @@ int event_expire(conf_t *conf, zone_t *zone)
assert(zone);
zone_contents_t *expired = zone_switch_contents(zone, NULL);
zone->flags |= ZONE_EXPIRED;
log_zone_info(zone->name, "zone expired");
synchronize_rcu();
......
......@@ -75,7 +75,6 @@ int event_load(conf_t *conf, zone_t *zone)
}
/* Everything went alright, switch the contents. */
zone->flags &= ~ZONE_EXPIRED;
zone->zonefile.exists = true;
zone_contents_t *old = zone_switch_contents(zone, contents);
bool old_contents = (old != NULL);
......
......@@ -667,7 +667,6 @@ static int publish_zone(conf_t *conf, zone_t *zone, const struct sockaddr *remot
// Publish new zone
zone_contents_t *old_zone = zone_switch_contents(zone, new_zone);
zone->flags &= ~ZONE_EXPIRED;
if (old_zone) {
REFRESH_LOG(LOG_INFO, zone->name, remote,
......
......@@ -46,11 +46,8 @@ typedef enum zone_flag_t {
ZONE_FORCE_AXFR = 1 << 0, /* Force AXFR as next transfer. */
ZONE_FORCE_RESIGN = 1 << 1, /* Force zone resign. */
ZONE_FORCE_FLUSH = 1 << 2, /* Force zone flush. */
ZONE_EXPIRED = 1 << 3, /* Zone is expired. */
} zone_flag_t;
/// XXX: ^ remove expired?
/*!
* \brief Structure for holding DNS zone.
*/
......
......@@ -170,8 +170,7 @@ static zone_t *create_zone_reload(conf_t *conf, const knot_dname_t *name,
timers_sanitize(conf, zone);
zone_status_t zstatus;
if (zone_is_slave(conf, zone) && old_zone->flags & ZONE_EXPIRED) {
zone->flags |= ZONE_EXPIRED;
if (zone_expired(zone)) {
zstatus = ZONE_STATUS_FOUND_CURRENT;
} else {
zstatus = zone_file_status(conf, old_zone, name);
......@@ -220,7 +219,7 @@ static zone_t *create_zone_new(conf_t *conf, const knot_dname_t *name,
timers_sanitize(conf, zone);
zone_status_t zstatus = zone_file_status(conf, NULL, name);
if (zone->flags & ZONE_EXPIRED) {
if (zone_expired(zone)) {
assert(zone_is_slave(conf, zone));
zstatus = ZONE_STATUS_BOOSTRAP;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment