From 929f0e7f859c6e87a60a7602bbf8bc955391a417 Mon Sep 17 00:00:00 2001 From: jake Date: Sun, 15 Sep 2019 13:15:19 -0700 Subject: [PATCH] add client_id arg to on_connect --- src/common/mainloop.rs | 2 +- src/common/serverstate.rs | 2 +- src/login/character.rs | 2 +- src/login/login.rs | 2 +- src/patch/main.rs | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/common/mainloop.rs b/src/common/mainloop.rs index 48681e7..1e6448b 100644 --- a/src/common/mainloop.rs +++ b/src/common/mainloop.rs @@ -23,7 +23,7 @@ fn recv_from_clientpool(state: &mut STATE, Ok(incoming) => { match incoming { ClientPoolAction::NewClient(client_id) => { - for s in state.on_connect().into_iter() { + for s in state.on_connect(client_id).into_iter() { match s { OnConnect::Cipher((in_cipher, out_cipher)) => { pool_send.send(ClientAction::EncryptionKeys(client_id, in_cipher, out_cipher)).unwrap(); diff --git a/src/common/serverstate.rs b/src/common/serverstate.rs index e47b189..2ea7742 100644 --- a/src/common/serverstate.rs +++ b/src/common/serverstate.rs @@ -22,7 +22,7 @@ pub trait ServerState { type RecvPacket: RecvServerPacket; type PacketError; - fn on_connect(&mut self) -> Vec>; + fn on_connect(&mut self, id: ClientId) -> Vec>; fn handle(&mut self, id: ClientId, pkt: &Self::RecvPacket) -> Box>; } diff --git a/src/login/character.rs b/src/login/character.rs index 4714296..379d106 100644 --- a/src/login/character.rs +++ b/src/login/character.rs @@ -246,7 +246,7 @@ impl ServerState for CharacterServerState { type RecvPacket = RecvCharacterPacket; type PacketError = CharacterError; - fn on_connect(&mut self) -> Vec> { + fn on_connect(&mut self, id: ClientId) -> Vec> { let mut rng = rand::thread_rng(); let mut server_key = [0u8; 48]; diff --git a/src/login/login.rs b/src/login/login.rs index b757685..c157ad8 100644 --- a/src/login/login.rs +++ b/src/login/login.rs @@ -119,7 +119,7 @@ impl ServerState for LoginServerState { type RecvPacket = RecvLoginPacket; type PacketError = LoginError; - fn on_connect(&mut self) -> Vec> { + fn on_connect(&mut self, id: ClientId) -> Vec> { let mut rng = rand::thread_rng(); let mut server_key = [0u8; 48]; diff --git a/src/patch/main.rs b/src/patch/main.rs index 82ff7e5..39b52d8 100644 --- a/src/patch/main.rs +++ b/src/patch/main.rs @@ -170,7 +170,7 @@ impl ServerState for PatchServerState { type RecvPacket = RecvPatchPacket; type PacketError = PatchError; - fn on_connect(&mut self) -> Vec> { + fn on_connect(&mut self, _id: ClientId) -> Vec> { let mut rng = rand::thread_rng(); let key_in: u32 = rng.gen(); let key_out: u32 = rng.gen();