mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-17 15:51:23 +01:00
Reload TLS config on SIGHUP
This commit is contained in:
parent
39880cc6ac
commit
94d523ebcb
4 changed files with 78 additions and 15 deletions
16
src/main.rs
16
src/main.rs
|
|
@ -44,6 +44,7 @@ fn version() -> String {
|
|||
#[derive(Debug, Clone, Copy)]
|
||||
enum ApplicationState {
|
||||
Ready,
|
||||
Reloading,
|
||||
Stopping,
|
||||
}
|
||||
|
||||
|
|
@ -61,6 +62,21 @@ fn set_application_state(state: ApplicationState) {
|
|||
|
||||
match state {
|
||||
ApplicationState::Ready => notify(&[NotifyState::Ready]),
|
||||
ApplicationState::Reloading => {
|
||||
let timespec = nix::time::clock_gettime(
|
||||
nix::time::ClockId::CLOCK_MONOTONIC,
|
||||
)
|
||||
.expect("CLOCK_MONOTONIC should be usable");
|
||||
let monotonic_usec =
|
||||
timespec.tv_sec() * 1_000_000 + timespec.tv_nsec() / 1000;
|
||||
|
||||
notify(&[
|
||||
NotifyState::Reloading,
|
||||
NotifyState::Custom(&format!(
|
||||
"MONOTONIC_USEC={monotonic_usec}",
|
||||
)),
|
||||
]);
|
||||
}
|
||||
ApplicationState::Stopping => notify(&[NotifyState::Stopping]),
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue