spacing cleanup, and removed leading digit
This commit is contained in:
parent
eb12e0abdf
commit
3a75b52f56
1 changed files with 4 additions and 1 deletions
|
@ -6,6 +6,7 @@ use workctl::sync_flag;
|
||||||
|
|
||||||
use crate::modules::stream_states::state_update::StateUpdate;
|
use crate::modules::stream_states::state_update::StateUpdate;
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
mod tests;
|
mod tests;
|
||||||
mod modules;
|
mod modules;
|
||||||
|
|
||||||
|
@ -25,15 +26,17 @@ fn main() {
|
||||||
setup_control_c(control_c_flag_tx);
|
setup_control_c(control_c_flag_tx);
|
||||||
let _outgoing = std::net::TcpStream::connect(SERVER_ADDRESS).unwrap();
|
let _outgoing = std::net::TcpStream::connect(SERVER_ADDRESS).unwrap();
|
||||||
socket.send("this is a message".to_string());
|
socket.send("this is a message".to_string());
|
||||||
|
|
||||||
//until control_c is caught, check the queue of incoming
|
//until control_c is caught, check the queue of incoming
|
||||||
//requests from the socket handler.
|
//requests from the socket handler.
|
||||||
while !control_c_called_flag_rx.get() {
|
while !control_c_called_flag_rx.get() {
|
||||||
match from_socket_rx.recv_timeout(Duration::from_millis(100)) {
|
match from_socket_rx.recv_timeout(Duration::from_millis(100)) {
|
||||||
Ok(message) => {
|
Ok(message) => {
|
||||||
println!("{}", 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);
|
let update = StateUpdate::json_to_state_update(json);
|
||||||
state.handle_update(update);
|
state.handle_update(update);
|
||||||
|
|
||||||
},
|
},
|
||||||
Err(_) => {continue},
|
Err(_) => {continue},
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue