From daaf52cca75835c64b65eaa0e5e0d1bda321862e Mon Sep 17 00:00:00 2001 From: Martin Brodbeck Date: Fri, 6 Oct 2023 08:40:42 +0200 Subject: [PATCH 1/2] debug messages added --- src/main.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main.rs b/src/main.rs index b33f9eb..886bd11 100644 --- a/src/main.rs +++ b/src/main.rs @@ -176,9 +176,11 @@ fn main() -> std::io::Result<()> { // Just do the very least of plausibility checks if number_of_bytes < 2 { // Abort if not at least 2 bytes have been received + debug!("Dropping unknown packet (too small)"); continue; } else if (buf[0] >> 6) != 1u8 { // Abort if protocol version is not "1" + debug!("Dropping unknown packet (version != 1)"); continue; } From a4abba23e2d974efda7a23313f644b1579b19e76 Mon Sep 17 00:00:00 2001 From: Martin Brodbeck Date: Fri, 6 Oct 2023 08:41:59 +0200 Subject: [PATCH 2/2] typo --- src/main.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 886bd11..c925cdd 100644 --- a/src/main.rs +++ b/src/main.rs @@ -158,7 +158,7 @@ fn main() -> std::io::Result<()> { let mut buf = [0; 64]; - // Waiting for incoming pakets. Otherwise, after timeout, send keepalive paket + // Waiting for incoming packets. Otherwise, after timeout, send keepalive packet let result = socket.recv_from(&mut buf); let (number_of_bytes, src_addr) = match result { Ok((num, s)) => (num, s), @@ -166,7 +166,7 @@ fn main() -> std::io::Result<()> { remove_old_clients(&socket, &mut subscribers); for rec in &subscribers { - debug!("Sending keepalive paket to {}", rec.0); + debug!("Sending keepalive packet to {}", rec.0); socket.send_to(b"", rec.0).unwrap(); } continue;