anti flood (?)
This commit is contained in:
parent
9794fc00ec
commit
1b8ea898f5
1 changed files with 3 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
||||||
use chrono::{DateTime, Duration, Local};
|
use chrono::{DateTime, Duration, Local};
|
||||||
use std::{collections::HashMap, net::UdpSocket};
|
use std::{collections::HashMap, net::UdpSocket, thread};
|
||||||
use log::debug;
|
use log::debug;
|
||||||
|
|
||||||
const MAX_CLIENTS: usize = 10;
|
const MAX_CLIENTS: usize = 10;
|
||||||
|
@ -135,6 +135,8 @@ fn main() -> std::io::Result<()> {
|
||||||
let speed = buf[1] >> 2;
|
let speed = buf[1] >> 2;
|
||||||
let data = &buf[0..number_of_bytes];
|
let data = &buf[0..number_of_bytes];
|
||||||
|
|
||||||
|
thread::sleep(core::time::Duration::from_millis(200)); // Anti floog (?)
|
||||||
|
|
||||||
if receivers2.contains_key(&client_addr) {
|
if receivers2.contains_key(&client_addr) {
|
||||||
debug!("Client known: {client_addr}");
|
debug!("Client known: {client_addr}");
|
||||||
if strip_header(data) == strip_header(mopp(speed, b":bye").as_slice()) {
|
if strip_header(data) == strip_header(mopp(speed, b":bye").as_slice()) {
|
||||||
|
|
Loading…
Reference in a new issue