From 39fd537855e80e74b082d691eb113c07d799c0b5 Mon Sep 17 00:00:00 2001 From: Luis Cruz Date: Mon, 16 Dec 2024 18:34:20 +0000 Subject: [PATCH] teliod: Add isAlive command for runtime query --- clis/teliod/src/command_listener.rs | 1 + clis/teliod/src/main.rs | 2 ++ clis/teliod/src/qnap.rs | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/clis/teliod/src/command_listener.rs b/clis/teliod/src/command_listener.rs index cb72d7835..fce865bc0 100644 --- a/clis/teliod/src/command_listener.rs +++ b/clis/teliod/src/command_listener.rs @@ -88,6 +88,7 @@ impl CommandListener { TeliodError::CommandFailed(ClientCmd::QuitDaemon) }) } + ClientCmd::IsAlive => Ok(CommandResponse::Ok), } } diff --git a/clis/teliod/src/main.rs b/clis/teliod/src/main.rs index c819f6774..e9021c5ba 100644 --- a/clis/teliod/src/main.rs +++ b/clis/teliod/src/main.rs @@ -37,6 +37,8 @@ const TIMEOUT_SEC: u64 = 1; enum ClientCmd { #[clap(about = "Retrieve the status report")] GetStatus, + #[clap(about = "Query if daemon is running")] + IsAlive, #[clap(about = "Stop daemon execution")] QuitDaemon, } diff --git a/clis/teliod/src/qnap.rs b/clis/teliod/src/qnap.rs index f60044603..a93dc6810 100644 --- a/clis/teliod/src/qnap.rs +++ b/clis/teliod/src/qnap.rs @@ -61,7 +61,7 @@ pub(crate) fn handle_request(request: Request) -> Response { } fn is_teliod_running() -> bool { - matches!(teliod_blocking_query!(ClientCmd::GetStatus), Ok(Ok(_))) + matches!(teliod_blocking_query!(ClientCmd::IsAlive), Ok(Ok(_))) } fn shutdown_teliod() -> Result<(), TeliodError> {