Browse Source

ServerState on_disconnect

pbs
jake 5 years ago
parent
commit
272be2db74
  1. 1
      src/common/serverstate.rs
  2. 4
      src/login/character.rs
  3. 4
      src/login/login.rs
  4. 4
      src/patch/patch.rs
  5. 6
      src/ship/ship.rs

1
src/common/serverstate.rs

@ -25,5 +25,6 @@ pub trait ServerState {
fn on_connect(&mut self, id: ClientId) -> Vec<OnConnect<Self::SendPacket>>; fn on_connect(&mut self, id: ClientId) -> Vec<OnConnect<Self::SendPacket>>;
fn handle(&mut self, id: ClientId, pkt: &Self::RecvPacket) fn handle(&mut self, id: ClientId, pkt: &Self::RecvPacket)
-> Result<Box<dyn Iterator<Item = (ClientId, Self::SendPacket)>>, Self::PacketError>; -> Result<Box<dyn Iterator<Item = (ClientId, Self::SendPacket)>>, Self::PacketError>;
fn on_disconnect(&mut self, id: ClientId) -> Vec<(ClientId, Self::SendPacket)>;
} }

4
src/login/character.rs

@ -454,6 +454,10 @@ impl<EG: EntityGateway> ServerState for CharacterServerState<EG> {
} }
}) })
} }
fn on_disconnect(&mut self, id: ClientId) -> Vec<(ClientId, SendCharacterPacket)> {
Vec::new()
}
} }
#[cfg(test)] #[cfg(test)]

4
src/login/login.rs

@ -131,6 +131,10 @@ impl<EG: EntityGateway> ServerState for LoginServerState<EG> {
} }
}) })
} }
fn on_disconnect(&mut self, id: ClientId) -> Vec<(ClientId, SendLoginPacket)> {
Vec::new()
}
} }
#[cfg(test)] #[cfg(test)]

4
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<u32, PatchFile>) -> PatchFileTree { fn load_patch_dir(basedir: &str, patchbase: &str, file_ids: &mut HashMap<u32, PatchFile>) -> PatchFileTree {

6
src/ship/ship.rs

@ -1,4 +1,5 @@
use std::collections::HashMap; use std::collections::HashMap;
use log::warn;
use rand::Rng; use rand::Rng;
@ -427,4 +428,9 @@ impl<EG: EntityGateway> ServerState for ShipServerState<EG> {
} }
}) })
} }
fn on_disconnect(&mut self, id: ClientId) -> Vec<(ClientId, SendShipPacket)> {
warn!("disconnected!");
Vec::new()
}
} }
Loading…
Cancel
Save