changed debug messages
This commit is contained in:
parent
94a5bd03e4
commit
4afab41abe
1 changed files with 4 additions and 2 deletions
|
@ -122,7 +122,7 @@ fn broadcast(
|
||||||
fn remove_old_clients(socket: &UdpSocket, subscribers: &mut HashMap<String, DateTime<Local>>) {
|
fn remove_old_clients(socket: &UdpSocket, subscribers: &mut HashMap<String, DateTime<Local>>) {
|
||||||
let timestamp = Local::now();
|
let timestamp = Local::now();
|
||||||
|
|
||||||
debug!("Number of clients: {}", subscribers.len());
|
//debug!("Number of clients: {}", subscribers.len());
|
||||||
|
|
||||||
for cl in &*subscribers {
|
for cl in &*subscribers {
|
||||||
if *cl.1 + Duration::seconds(CLIENT_TIMEOUT as i64) < timestamp {
|
if *cl.1 + Duration::seconds(CLIENT_TIMEOUT as i64) < timestamp {
|
||||||
|
@ -157,8 +157,9 @@ fn main() -> std::io::Result<()> {
|
||||||
Ok((num, s)) => (num, s),
|
Ok((num, s)) => (num, s),
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
remove_old_clients(&socket, &mut subscribers);
|
remove_old_clients(&socket, &mut subscribers);
|
||||||
debug!("Sending keepalive pakets …");
|
// debug!("Sending keepalive pakets …");
|
||||||
for rec in &subscribers {
|
for rec in &subscribers {
|
||||||
|
debug!("Sending keepalive paket to {}", rec.0);
|
||||||
socket.send_to(b"", rec.0).unwrap();
|
socket.send_to(b"", rec.0).unwrap();
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
@ -173,6 +174,7 @@ fn main() -> std::io::Result<()> {
|
||||||
|
|
||||||
if subscribers.contains_key(&client_addr) {
|
if subscribers.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()) {
|
||||||
debug!("Removing client {client_addr} as requested.");
|
debug!("Removing client {client_addr} as requested.");
|
||||||
socket
|
socket
|
||||||
|
|
Loading…
Reference in a new issue