From ccbd4444c400d7901a71d36f6a3edd98f62cc2a1 Mon Sep 17 00:00:00 2001 From: Kyle Johnsen Date: Tue, 18 Jan 2022 02:25:13 -0500 Subject: [PATCH] hack fix for two clients leaving a room at the exact same time --- src/main.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 5573e38..a75c61a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -85,7 +85,11 @@ fn send_client_join_message(to: &Arc, from: u32, room: &str){ writeBuf.extend_from_slice(&(from).to_be_bytes()); //send everyone that the client id joined the room writeBuf.push(room.as_bytes().len() as u8); writeBuf.extend_from_slice(room.as_bytes()); - to.sender.send(writeBuf).unwrap(); + let res = to.sender.send(writeBuf); + match res { + Ok(_) => println!("send successful"), + Err(_) => println!("send unsuccessful") + } } fn client_leave_room(mut client: &Arc, send_to_client: bool){