cli and daemon "PING-PONG" communication
parent
014e8dd56d
commit
4d2fe57680
|
|
@ -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" }
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue