Check for client's existence before handling messages
authoralfadur
Wed, 04 Jul 2018 15:42:42 +0300
changeset 13442 c6a3784ff2c1
parent 13441 d47514fd6c6a
child 13443 2501428303a2
Check for client's existence before handling messages
gameServer2/src/server/server.rs
--- a/gameServer2/src/server/server.rs	Wed Jul 04 13:56:49 2018 +0300
+++ b/gameServer2/src/server/server.rs	Wed Jul 04 15:42:42 2018 +0300
@@ -58,7 +58,9 @@
 
     pub fn handle_msg(&mut self, client_id: ClientId, msg: HWProtocolMessage) {
         debug!("Handling message {:?} for client {}", msg, client_id);
-        handlers::handle(self, client_id, msg);
+        if self.clients.contains(client_id) {
+            handlers::handle(self, client_id, msg);
+        }
     }
 
     fn get_recipients(&self, client_id: ClientId, destination: Destination) -> Vec<ClientId> {