Skip to content
Snippets Groups Projects
Commit 4d449374 authored by Daniel Salzman's avatar Daniel Salzman
Browse files

knot: fix crash if timers DB not open during shutdown

parent ec66577c
Branches
Tags
No related merge requests found
Pipeline #1448 passed with stages
in 4 minutes and 56 seconds
......@@ -441,10 +441,12 @@ void zonedb_reload(conf_t *conf, server_t *server)
synchronize_rcu();
/* Sweep the timer database. */
int ret = zone_timers_sweep(server->timers_db, zone_exists, db_new);
if (ret != KNOT_EOK) {
log_warning("failed to clear persistent timers for removed zones (%s)",
knot_strerror(ret));
if (server->timers_db != NULL) {
int ret = zone_timers_sweep(server->timers_db, zone_exists, db_new);
if (ret != KNOT_EOK) {
log_warning("failed to clear persistent timers DB (%s)",
knot_strerror(ret));
}
}
/* Remove old zone DB. */
......
......@@ -385,7 +385,11 @@ static void write_timers(const zone_t *zone, knot_db_txn_t *txn, int *ret)
static void update_timerdb(server_t *server)
{
log_info("updating zone timers database");
if (server->timers_db == NULL) {
return;
}
log_info("updating persistent timers DB");
knot_db_txn_t txn;
int ret = zone_timers_write_begin(server->timers_db, &txn);
......@@ -396,7 +400,8 @@ static void update_timerdb(server_t *server)
ret = zone_timers_write_end(&txn);
}
if (ret != KNOT_EOK) {
log_warning("failed to update zone timers database (%s)", knot_strerror(ret));
log_warning("failed to update persistent timers DB (%s)",
knot_strerror(ret));
}
}
......
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