1 /*  Copyright (C) 2021 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
2 
3     This program is free software: you can redistribute it and/or modify
4     it under the terms of the GNU General Public License as published by
5     the Free Software Foundation, either version 3 of the License, or
6     (at your option) any later version.
7 
8     This program is distributed in the hope that it will be useful,
9     but WITHOUT ANY WARRANTY; without even the implied warranty of
10     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11     GNU General Public License for more details.
12 
13     You should have received a copy of the GNU General Public License
14     along with this program.  If not, see <https://www.gnu.org/licenses/>.
15  */
16 
17 #include "knot/common/log.h"
18 #include "knot/conf/conf.h"
19 #include "knot/events/events.h"
20 #include "knot/zone/zone.h"
21 
event_ufreeze(conf_t * conf,zone_t * zone)22 int event_ufreeze(conf_t *conf, zone_t *zone)
23 {
24 	assert(zone);
25 
26 	pthread_mutex_lock(&zone->events.mx);
27 	zone->events.ufrozen = true;
28 	pthread_mutex_unlock(&zone->events.mx);
29 
30 	log_zone_info(zone->name, "zone updates frozen");
31 
32 	return KNOT_EOK;
33 }
34 
event_uthaw(conf_t * conf,zone_t * zone)35 int event_uthaw(conf_t *conf, zone_t *zone)
36 {
37 	assert(zone);
38 
39 	pthread_mutex_lock(&zone->events.mx);
40 	zone->events.ufrozen = false;
41 	pthread_mutex_unlock(&zone->events.mx);
42 
43 	log_zone_info(zone->name, "zone updates unfrozen");
44 
45 	return KNOT_EOK;
46 }
47