gameServer2/src/server/server.rs
changeset 13524 5359ff75da3a
parent 13521 ba5211dddb21
child 13666 09f4a30e50cc
--- a/gameServer2/src/server/server.rs	Tue Jul 17 00:27:24 2018 +0300
+++ b/gameServer2/src/server/server.rs	Tue Jul 17 16:03:34 2018 +0300
@@ -40,7 +40,7 @@
             let client = HWClient::new(entry.key());
             entry.insert(client);
         }
-        self.send(key, Destination::ToSelf, HWServerMessage::Connected(utils::PROTOCOL_VERSION));
+        self.send(key, &Destination::ToSelf, HWServerMessage::Connected(utils::PROTOCOL_VERSION));
         key
     }
 
@@ -64,8 +64,8 @@
         }
     }
 
-    fn get_recipients(&self, client_id: ClientId, destination: Destination) -> Vec<ClientId> {
-        let mut ids = match destination {
+    fn get_recipients(&self, client_id: ClientId, destination: &Destination) -> Vec<ClientId> {
+        let mut ids = match *destination {
             Destination::ToSelf => vec![client_id],
             Destination::ToId(id) => vec![id],
             Destination::ToAll {room_id: Some(id), ..} =>
@@ -83,8 +83,8 @@
         ids
     }
 
-    pub fn send(&mut self, client_id: ClientId, destination: Destination, message: HWServerMessage) {
-        let ids = self.get_recipients(client_id, destination);
+    pub fn send(&mut self, client_id: ClientId, destination: &Destination, message: HWServerMessage) {
+        let ids = self.get_recipients(client_id, &destination);
         self.output.push((ids, message));
     }