Add forced shutdown to ptth_relay.

main
_ 2020-11-07 02:29:45 +00:00
parent 9e134d55aa
commit e0b8c8cb58
2 changed files with 11 additions and 7 deletions

View File

@ -25,8 +25,14 @@ async fn main () -> Result <(), Box <dyn Error>> {
info! ("ptth_relay Git version: {:?}", ptth::git_version::GIT_VERSION); info! ("ptth_relay Git version: {:?}", ptth::git_version::GIT_VERSION);
let (shutdown_rx, forced_shutdown) = ptth::graceful_shutdown::init_with_force ();
forced_shutdown.wrap_server (
relay::run_relay ( relay::run_relay (
Arc::new (RelayState::from (&config_file)), Arc::new (RelayState::from (&config_file)),
ptth::graceful_shutdown::init () shutdown_rx
).await )
).await??;
Ok (())
} }

View File

@ -586,7 +586,6 @@ pub async fn run_relay (
server.with_graceful_shutdown (async { server.with_graceful_shutdown (async {
shutdown_oneshot.await.ok (); shutdown_oneshot.await.ok ();
info! ("Received graceful shutdown");
state.shutdown_watch_tx.broadcast (true).unwrap (); 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?; }).await?;
info! ("Exiting");
Ok (()) Ok (())
} }