Skip to content

Commit

Permalink
teliod: Add isAlive command for runtime query
Browse files Browse the repository at this point in the history
  • Loading branch information
lcruz99 committed Dec 17, 2024
1 parent f1a6a82 commit f28351d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions clis/teliod/src/command_listener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ impl CommandListener {
TeliodError::CommandFailed(ClientCmd::QuitDaemon)
})
}
ClientCmd::IsAlive => Ok(CommandResponse::Ok),
}
}

Expand Down
2 changes: 2 additions & 0 deletions clis/teliod/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down
2 changes: 1 addition & 1 deletion clis/teliod/src/qnap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,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> {
Expand Down

0 comments on commit f28351d

Please sign in to comment.