diff --git a/src/main.rs b/src/main.rs index 8bbffd8..9753e4c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -122,7 +122,7 @@ fn broadcast( fn remove_old_clients(socket: &UdpSocket, subscribers: &mut HashMap>) { let timestamp = Local::now(); - debug!("Number of clients: {}", subscribers.len()); + //debug!("Number of clients: {}", subscribers.len()); for cl in &*subscribers { if *cl.1 + Duration::seconds(CLIENT_TIMEOUT as i64) < timestamp { @@ -157,8 +157,9 @@ fn main() -> std::io::Result<()> { Ok((num, s)) => (num, s), Err(_) => { remove_old_clients(&socket, &mut subscribers); - debug!("Sending keepalive pakets …"); + // debug!("Sending keepalive pakets …"); for rec in &subscribers { + debug!("Sending keepalive paket to {}", rec.0); socket.send_to(b"", rec.0).unwrap(); } continue; @@ -173,6 +174,7 @@ fn main() -> std::io::Result<()> { if subscribers.contains_key(&client_addr) { debug!("Client known: {client_addr}"); + if strip_header(data) == strip_header(mopp(speed, b":bye").as_slice()) { debug!("Removing client {client_addr} as requested."); socket