From 3a75b52f56310cdda292ee018355f116ceb0f800 Mon Sep 17 00:00:00 2001 From: Nickiel12 <35903114+Nickiel12@users.noreply.github.com> Date: Wed, 29 Dec 2021 21:15:20 -0800 Subject: [PATCH] spacing cleanup, and removed leading digit --- src/main.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 950b4f7..45190a4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -6,6 +6,7 @@ use workctl::sync_flag; use crate::modules::stream_states::state_update::StateUpdate; +#[cfg(test)] mod tests; mod modules; @@ -25,15 +26,17 @@ fn main() { setup_control_c(control_c_flag_tx); let _outgoing = std::net::TcpStream::connect(SERVER_ADDRESS).unwrap(); socket.send("this is a message".to_string()); + //until control_c is caught, check the queue of incoming //requests from the socket handler. while !control_c_called_flag_rx.get() { match from_socket_rx.recv_timeout(Duration::from_millis(100)) { Ok(message) => { println!("{}", message); - let json = serde_json::from_str(&message[1..]).unwrap(); + let json = serde_json::from_str(&message).unwrap(); let update = StateUpdate::json_to_state_update(json); state.handle_update(update); + }, Err(_) => {continue}, }