diff --git a/odilia/src/main.rs b/odilia/src/main.rs index ddfcc065..0933f7c5 100644 --- a/odilia/src/main.rs +++ b/odilia/src/main.rs @@ -25,7 +25,6 @@ use odilia_notify::listen_to_dbus_notifications; use ssip_client_async::Priority; use tokio::{ signal::unix::{signal, SignalKind}, - sync::broadcast::{self, error::SendError}, sync::mpsc, }; use tokio_util::sync::CancellationToken; @@ -51,15 +50,11 @@ async fn notifications_monitor( } Ok(()) } -async fn sigterm_signal_watcher( - token: CancellationToken, - shutdown_tx: broadcast::Sender, -) -> eyre::Result<()> { +async fn sigterm_signal_watcher(token: CancellationToken) -> eyre::Result<()> { let mut c = signal(SignalKind::interrupt())?; tracing::debug!("Watching for Ctrl+C"); c.recv().await; tracing::debug!("Asking all processes to stop."); - let _: Result> = shutdown_tx.send(0); tracing::debug!("cancelling all tokens"); token.cancel(); Ok(()) @@ -77,7 +72,6 @@ async fn main() -> eyre::Result<()> { if let Err(e) = atspi_connection::set_session_accessibility(true).await { tracing::debug!("Could not set AT-SPI2 IsEnabled property because: {}", e); } - let (shutdown_tx, _) = broadcast::channel(1); let (sr_event_tx, mut sr_event_rx) = mpsc::channel(128); // this channel must NEVER fill up; it will cause the thread receiving events to deadlock due to a zbus design choice. // If you need to make it bigger, then make it bigger, but do NOT let it ever fill up. @@ -124,7 +118,7 @@ async fn main() -> eyre::Result<()> { .map(|r| r.wrap_err("Could not process Odilia event")); let notification_task = notifications_monitor(Arc::clone(&state), token.clone()) .map(|r| r.wrap_err("Could not process signal shutdown.")); - let signal_receiver = sigterm_signal_watcher(token, shutdown_tx) + let signal_receiver = sigterm_signal_watcher(token) .map(|r| r.wrap_err("Could not process signal shutdown.")); tokio::try_join!(