cli and daemon "PING-PONG" communication

pull/19/head
prplV 2025-01-09 16:36:33 +03:00
parent 014e8dd56d
commit 4d2fe57680
2 changed files with 13 additions and 1 deletions

View File

@ -16,3 +16,4 @@ serde = { version = "1.0.203", features = ["derive"] }
serde_json = "1.0.118"
sysinfo = "0.32.0"
tokio = { version = "1.38.0", features = ["full", "time"] }
noxis-cli = { path = "../noxis-cli" }

View File

@ -5,6 +5,8 @@ use tokio::time::{sleep, Duration};
use std::{borrow::BorrowMut, net::{IpAddr, Ipv4Addr}};
// use std::io::BufReader;
use tokio::io::{BufReader, AsyncWriteExt, AsyncBufReadExt};
use noxis_cli::Cli;
use serde_json::from_str;
/// # Fn `init_cli_pipeline`
/// ## for catching all input requests from CLI
@ -85,7 +87,16 @@ async fn process_connection(mut stream: TcpStream) {
while let Ok(Some(line)) = rqst.next_line().await {
if line.is_empty() {
break;
break
}
match from_str::<Cli>(&line) {
Ok(req) => {
// TODO: func wrapper
dbg!(req);
},
Err(_) => {
break
},
}
println!("{}", line);
}