From 1b8ea898f51f5bdfaa5c2b5fe835ff9fcb78bf06 Mon Sep 17 00:00:00 2001 From: Martin Brodbeck Date: Tue, 3 Oct 2023 22:24:02 +0200 Subject: [PATCH] anti flood (?) --- src/main.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index f86891c..768bfc4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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()) {