rust/hedgewars-server/src/server/network.rs
changeset 15178 21e87882df1c
parent 15108 823052e66611
child 15179 e705ac360785
equal deleted inserted replaced
15177:dc94bb5990a0 15178:21e87882df1c
   347 
   347 
   348         Ok(())
   348         Ok(())
   349     }
   349     }
   350 
   350 
   351     fn deregister_client(&mut self, poll: &Poll, id: ClientId) {
   351     fn deregister_client(&mut self, poll: &Poll, id: ClientId) {
   352         let mut client_exists = false;
       
   353         if let Some(ref client) = self.clients.get(id) {
   352         if let Some(ref client) = self.clients.get(id) {
   354             poll.deregister(client.socket.inner())
   353             poll.deregister(client.socket.inner())
   355                 .expect("could not deregister socket");
   354                 .expect("could not deregister socket");
   356             info!("client {} ({}) removed", client.id, client.peer_addr);
   355             info!("client {} ({}) removed", client.id, client.peer_addr);
   357             client_exists = true;
       
   358         }
       
   359         if client_exists {
       
   360             self.clients.remove(id);
   356             self.clients.remove(id);
   361             #[cfg(feature = "official-server")]
   357             #[cfg(feature = "official-server")]
   362             self.io.cancel(id);
   358             self.io.cancel(id);
   363         }
   359         }
   364     }
   360     }