rust/hedgewars-server/src/server/core.rs
changeset 14696 8a45c90f4580
parent 14695 216d39de1a44
child 14697 f64e21f164a5
--- a/rust/hedgewars-server/src/server/core.rs	Thu Feb 07 18:04:53 2019 +0300
+++ b/rust/hedgewars-server/src/server/core.rs	Thu Feb 07 22:26:56 2019 +0300
@@ -1,14 +1,11 @@
 use super::{
-    actions,
-    actions::{Destination, PendingMessage},
     client::HWClient,
     coretypes::{ClientId, RoomId},
-    handlers,
     indexslab::IndexSlab,
     io::HWServerIO,
     room::HWRoom,
 };
-use crate::{protocol::messages::*, utils};
+use crate::utils;
 
 use log::*;
 use slab;
@@ -45,7 +42,11 @@
 
     pub fn remove_client(&mut self, client_id: ClientId) -> Option<HWAnteClient> {
         let mut client = self.clients.remove(client_id);
-        if let Some(HWAnteClient { web_password: Some(ref mut password), ..}) = client {
+        if let Some(HWAnteClient {
+            web_password: Some(ref mut password),
+            ..
+        }) = client
+        {
             password.replace_range(.., "🦔🦔🦔🦔🦔🦔🦔🦔");
         }
         client
@@ -55,8 +56,6 @@
 pub struct HWServer {
     pub clients: IndexSlab<HWClient>,
     pub rooms: Slab<HWRoom>,
-    pub output: Vec<(Vec<ClientId>, HWServerMessage)>,
-    pub removed_clients: Vec<ClientId>,
     pub io: Box<dyn HWServerIO>,
     pub anteroom: HWAnteroom,
 }
@@ -68,8 +67,6 @@
         Self {
             clients,
             rooms,
-            output: vec![],
-            removed_clients: vec![],
             io,
             anteroom: HWAnteroom::new(clients_limit),
         }
@@ -83,10 +80,7 @@
     }
 
     pub fn remove_client(&mut self, client_id: ClientId) {
-        self.removed_clients.push(client_id);
-        if self.clients.contains(client_id) {
-            self.clients.remove(client_id);
-        }
+        self.clients.remove(client_id);
     }
 
     pub fn add_room(&mut self) -> &mut HWRoom {