Instance: flush input cache on SIGHUP

This commit is contained in:
Max Kellermann
2020-02-16 20:38:56 +01:00
parent 29d05cdb8e
commit d1cc73775f
4 changed files with 24 additions and 4 deletions

View File

@@ -47,10 +47,14 @@ x_sigaction(int signum, const struct sigaction *act)
}
static void
handle_reload_event(void *) noexcept
handle_reload_event(void *ctx) noexcept
{
LogDebug(signal_handlers_domain, "got SIGHUP, reopening log files");
auto &instance = *(Instance *)ctx;
LogDebug(signal_handlers_domain, "got SIGHUP, reopening log files and flushing caches");
cycle_log_files();
instance.FlushCaches();
}
#endif
@@ -73,7 +77,7 @@ SignalHandlersInit(Instance &instance)
SignalMonitorRegister(SIGINT, {&loop, HandleShutdownSignal});
SignalMonitorRegister(SIGTERM, {&loop, HandleShutdownSignal});
SignalMonitorRegister(SIGHUP, {nullptr, handle_reload_event});
SignalMonitorRegister(SIGHUP, {&instance, handle_reload_event});
#endif
}