diff --git a/src/main.rs b/src/main.rs index 2e4ca0b..69eb24b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -14,13 +14,6 @@ struct Client { time: DateTime, } -fn print_msg(msg: &[u8]) { - for elem in msg { - print!("{:08b} ", elem); - } - println!(""); -} - fn strip_header(msg: &[u8]) -> Vec { //print_msg(msg); let mut stripped = Vec::new(); @@ -103,12 +96,6 @@ fn mopp(speed: u8, data: &[u8]) -> Vec { m.replace_range(m.len() - 2.., "11"); // EOW - println!( - "MOPP: {1:0$}", - (8 as f32 * (m.len() as f32 / 8 as f32).ceil()) as usize, - m - ); - m = format!( "{1:0<0$}", (8 as f32 * (m.len() as f32 / 8 as f32).ceil()) as usize, @@ -156,10 +143,10 @@ fn main() -> std::io::Result<()> { let data = &buf[0..number_of_bytes]; if receivers.iter().any(|x| x.name == client_addr) { - println!("Client already known."); + //println!("Client already known."); broadcast(&socket, &receivers, &client, data); } else if strip_header(data) == strip_header(mopp(speed, b"hi").as_slice()) { - println!("Welcome!"); + //println!("Welcome!"); if receivers.len() < MAX_CLIENTS { receivers.insert(client.clone()); socket @@ -171,7 +158,7 @@ fn main() -> std::io::Result<()> { .unwrap(); } } else { - println!("Unknown client - Ignoring"); + //println!("Unknown client - Ignoring"); } let timestamp = Local::now();