Add forced shutdown to ptth_relay.
parent
9e134d55aa
commit
e0b8c8cb58
|
@ -25,8 +25,14 @@ async fn main () -> Result <(), Box <dyn Error>> {
|
|||
|
||||
info! ("ptth_relay Git version: {:?}", ptth::git_version::GIT_VERSION);
|
||||
|
||||
relay::run_relay (
|
||||
Arc::new (RelayState::from (&config_file)),
|
||||
ptth::graceful_shutdown::init ()
|
||||
).await
|
||||
let (shutdown_rx, forced_shutdown) = ptth::graceful_shutdown::init_with_force ();
|
||||
|
||||
forced_shutdown.wrap_server (
|
||||
relay::run_relay (
|
||||
Arc::new (RelayState::from (&config_file)),
|
||||
shutdown_rx
|
||||
)
|
||||
).await??;
|
||||
|
||||
Ok (())
|
||||
}
|
||||
|
|
|
@ -586,7 +586,6 @@ pub async fn run_relay (
|
|||
|
||||
server.with_graceful_shutdown (async {
|
||||
shutdown_oneshot.await.ok ();
|
||||
info! ("Received graceful shutdown");
|
||||
|
||||
state.shutdown_watch_tx.broadcast (true).unwrap ();
|
||||
|
||||
|
@ -612,10 +611,9 @@ pub async fn run_relay (
|
|||
}
|
||||
}
|
||||
|
||||
info! ("Performed all cleanup");
|
||||
debug! ("Performed all cleanup");
|
||||
}).await?;
|
||||
|
||||
info! ("Exiting");
|
||||
Ok (())
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue