Compare commits
No commits in common. "a4abba23e2d974efda7a23313f644b1579b19e76" and "6d2e797b618df2671e02d0b2b6ee521b0e389d6d" have entirely different histories.
a4abba23e2
...
6d2e797b61
1 changed files with 2 additions and 4 deletions
|
@ -158,7 +158,7 @@ fn main() -> std::io::Result<()> {
|
||||||
|
|
||||||
let mut buf = [0; 64];
|
let mut buf = [0; 64];
|
||||||
|
|
||||||
// Waiting for incoming packets. Otherwise, after timeout, send keepalive packet
|
// Waiting for incoming pakets. Otherwise, after timeout, send keepalive paket
|
||||||
let result = socket.recv_from(&mut buf);
|
let result = socket.recv_from(&mut buf);
|
||||||
let (number_of_bytes, src_addr) = match result {
|
let (number_of_bytes, src_addr) = match result {
|
||||||
Ok((num, s)) => (num, s),
|
Ok((num, s)) => (num, s),
|
||||||
|
@ -166,7 +166,7 @@ fn main() -> std::io::Result<()> {
|
||||||
remove_old_clients(&socket, &mut subscribers);
|
remove_old_clients(&socket, &mut subscribers);
|
||||||
|
|
||||||
for rec in &subscribers {
|
for rec in &subscribers {
|
||||||
debug!("Sending keepalive packet to {}", rec.0);
|
debug!("Sending keepalive paket to {}", rec.0);
|
||||||
socket.send_to(b"", rec.0).unwrap();
|
socket.send_to(b"", rec.0).unwrap();
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
@ -176,11 +176,9 @@ fn main() -> std::io::Result<()> {
|
||||||
// Just do the very least of plausibility checks
|
// Just do the very least of plausibility checks
|
||||||
if number_of_bytes < 2 {
|
if number_of_bytes < 2 {
|
||||||
// Abort if not at least 2 bytes have been received
|
// Abort if not at least 2 bytes have been received
|
||||||
debug!("Dropping unknown packet (too small)");
|
|
||||||
continue;
|
continue;
|
||||||
} else if (buf[0] >> 6) != 1u8 {
|
} else if (buf[0] >> 6) != 1u8 {
|
||||||
// Abort if protocol version is not "1"
|
// Abort if protocol version is not "1"
|
||||||
debug!("Dropping unknown packet (version != 1)");
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue