mirror of
https://github.com/redstrate/Kawari.git
synced 2025-04-20 14:47:45 +00:00
Remove disconnected clients from the client list
This commit is contained in:
parent
121415b163
commit
df1d0b2629
2 changed files with 6 additions and 0 deletions
|
@ -122,6 +122,9 @@ async fn main_loop(mut recv: Receiver<ToServer>) -> Result<(), std::io::Error> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ToServer::Disconnected(from_id) => {
|
||||||
|
to_remove.push(from_id);
|
||||||
|
}
|
||||||
ToServer::FatalError(err) => return Err(err),
|
ToServer::FatalError(err) => return Err(err),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -573,6 +576,8 @@ async fn client_loop(
|
||||||
}
|
}
|
||||||
ClientZoneIpcData::Disconnected { .. } => {
|
ClientZoneIpcData::Disconnected { .. } => {
|
||||||
tracing::info!("Client disconnected!");
|
tracing::info!("Client disconnected!");
|
||||||
|
|
||||||
|
connection.handle.send(ToServer::Disconnected(connection.id)).await;
|
||||||
}
|
}
|
||||||
ClientZoneIpcData::ChatMessage(chat_message) => {
|
ClientZoneIpcData::ChatMessage(chat_message) => {
|
||||||
connection.handle.send(ToServer::Message(connection.id, chat_message.message.clone())).await;
|
connection.handle.send(ToServer::Message(connection.id, chat_message.message.clone())).await;
|
||||||
|
|
|
@ -99,6 +99,7 @@ pub enum ToServer {
|
||||||
ActorSpawned(ClientId, Actor, CommonSpawn),
|
ActorSpawned(ClientId, Actor, CommonSpawn),
|
||||||
ActorMoved(ClientId, u32, Position, f32),
|
ActorMoved(ClientId, u32, Position, f32),
|
||||||
ZoneLoaded(ClientId),
|
ZoneLoaded(ClientId),
|
||||||
|
Disconnected(ClientId),
|
||||||
FatalError(std::io::Error),
|
FatalError(std::io::Error),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue