ServerState on_disconnect

This commit is contained in:
jake 2020-01-08 22:02:51 -08:00
parent 704d6386f7
commit 272be2db74
5 changed files with 19 additions and 0 deletions

View File

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

View File

@ -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)]

View File

@ -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)]

View File

@ -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 {

View File

@ -1,4 +1,5 @@
use std::collections::HashMap;
use log::warn;
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()
}
}