From 69512798bc37b2d3c2d8b8a03c47860230a6ab7b Mon Sep 17 00:00:00 2001 From: Johnny Santos Date: Sat, 29 Jun 2024 21:48:38 -0300 Subject: [PATCH] Listen to exit signal --- roles/mining-proxy/src/main.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/roles/mining-proxy/src/main.rs b/roles/mining-proxy/src/main.rs index 0725c189b1..7ad23a616e 100644 --- a/roles/mining-proxy/src/main.rs +++ b/roles/mining-proxy/src/main.rs @@ -23,7 +23,7 @@ mod lib; use lib::Config; use roles_logic_sv2::utils::{GroupId, Mutex}; use std::{net::SocketAddr, sync::Arc}; -use tracing::{error, info}; +use tracing::{error, info, warn}; mod args { use std::path::PathBuf; @@ -137,5 +137,9 @@ async fn main() { ); info!("PROXY INITIALIZED"); - crate::lib::downstream_mining::listen_for_downstream_mining(socket).await + + tokio::select! { + _ = lib::downstream_mining::listen_for_downstream_mining(socket) => warn!("Downstream mining exited"), + _ = tokio::signal::ctrl_c() => info!("Interrupt received"), + } }