hack fix for two clients leaving a room at the exact same time

main
Kyle Johnsen 2022-01-18 02:25:13 -05:00
parent efeb05f5f1
commit ccbd4444c4
1 changed files with 5 additions and 1 deletions

View File

@ -85,7 +85,11 @@ fn send_client_join_message(to: &Arc<Client>, from: u32, room: &str){
writeBuf.extend_from_slice(&(from).to_be_bytes()); //send everyone that the client id joined the room 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.push(room.as_bytes().len() as u8);
writeBuf.extend_from_slice(room.as_bytes()); 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<Client>, send_to_client: bool){ fn client_leave_room(mut client: &Arc<Client>, send_to_client: bool){