anti flood (?)

This commit is contained in:
Martin Brodbeck 2023-10-03 22:24:02 +02:00
parent 9794fc00ec
commit 1b8ea898f5

View file

@ -1,5 +1,5 @@
use chrono::{DateTime, Duration, Local};
use std::{collections::HashMap, net::UdpSocket};
use std::{collections::HashMap, net::UdpSocket, thread};
use log::debug;
const MAX_CLIENTS: usize = 10;
@ -135,6 +135,8 @@ fn main() -> std::io::Result<()> {
let speed = buf[1] >> 2;
let data = &buf[0..number_of_bytes];
thread::sleep(core::time::Duration::from_millis(200)); // Anti floog (?)
if receivers2.contains_key(&client_addr) {
debug!("Client known: {client_addr}");
if strip_header(data) == strip_header(mopp(speed, b":bye").as_slice()) {