diff --git a/src/common/serverstate.rs b/src/common/serverstate.rs index 40980af..3ed7fa7 100644 --- a/src/common/serverstate.rs +++ b/src/common/serverstate.rs @@ -25,5 +25,6 @@ pub trait ServerState { fn on_connect(&mut self, id: ClientId) -> Vec>; fn handle(&mut self, id: ClientId, pkt: &Self::RecvPacket) -> Result>, Self::PacketError>; + fn on_disconnect(&mut self, id: ClientId) -> Vec<(ClientId, Self::SendPacket)>; } diff --git a/src/login/character.rs b/src/login/character.rs index 8a7c846..a8bef2b 100644 --- a/src/login/character.rs +++ b/src/login/character.rs @@ -454,6 +454,10 @@ impl ServerState for CharacterServerState { } }) } + + fn on_disconnect(&mut self, id: ClientId) -> Vec<(ClientId, SendCharacterPacket)> { + Vec::new() + } } #[cfg(test)] diff --git a/src/login/login.rs b/src/login/login.rs index 573d5fc..25dcb02 100644 --- a/src/login/login.rs +++ b/src/login/login.rs @@ -131,6 +131,10 @@ impl ServerState for LoginServerState { } }) } + + fn on_disconnect(&mut self, id: ClientId) -> Vec<(ClientId, SendLoginPacket)> { + Vec::new() + } } #[cfg(test)] diff --git a/src/patch/patch.rs b/src/patch/patch.rs index dcca2be..63693f9 100644 --- a/src/patch/patch.rs +++ b/src/patch/patch.rs @@ -200,6 +200,10 @@ impl ServerState for PatchServerState { } }) } + + fn on_disconnect(&mut self, id: ClientId) -> Vec<(ClientId, SendPatchPacket)> { + Vec::new() + } } fn load_patch_dir(basedir: &str, patchbase: &str, file_ids: &mut HashMap) -> PatchFileTree { diff --git a/src/ship/ship.rs b/src/ship/ship.rs index 235fb6b..46d807d 100644 --- a/src/ship/ship.rs +++ b/src/ship/ship.rs @@ -1,4 +1,5 @@ use std::collections::HashMap; +use log::warn; use rand::Rng; @@ -427,4 +428,9 @@ impl ServerState for ShipServerState { } }) } + + fn on_disconnect(&mut self, id: ClientId) -> Vec<(ClientId, SendShipPacket)> { + warn!("disconnected!"); + Vec::new() + } }