From 8d6af9cf8a669009d6657dc19e3d4282d8fb5565 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Mon, 22 Mar 2021 13:34:57 -0700 Subject: fix: Only send to one client not all for certain commands --- src/server/world.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/server') diff --git a/src/server/world.rs b/src/server/world.rs index 4764b36..d0a47f7 100644 --- a/src/server/world.rs +++ b/src/server/world.rs @@ -1,5 +1,5 @@ use mio::net::{TcpListener, TcpStream}; -use std::io::Read; +use std::io::{Read, Write}; use mio::{Poll, Token, Ready, PollOpt, Events}; use std::collections::HashMap; use std::str::from_utf8; @@ -83,13 +83,15 @@ impl WorldServer { // PROPREQ 10 => { info!("received property request command"); - broadcast_to_all_clients(&sockets, &create_property_update_command()); + sockets.get_mut(&token).unwrap() + .write_all(&create_property_update_command()).unwrap(); info!("sent property update"); } // SESSINIT 6 => { info!("received session initialization command"); - broadcast_to_all_clients(&sockets, &create_property_request_command()); + sockets.get_mut(&token).unwrap() + .write_all(&create_property_request_command()).unwrap(); info!("sent session initialization command") } // PROPSET @@ -97,11 +99,9 @@ impl WorldServer { // BUDDYLISTUPDATE 29 => { info!("received buddy list update command"); - - broadcast_to_all_clients( - &sockets, - &create_buddy_list_notify_command("Wirlaburla") - ); + sockets.get_mut(&token).unwrap() + .write_all(&create_buddy_list_notify_command("Wirlaburla")) + .unwrap(); info!("sent buddy notify update command") } // ROOMIDRQ -- cgit v1.2.3