mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2026-04-04 14:56:04 +00:00
Update mod.rs
This commit is contained in:
@@ -161,13 +161,12 @@ impl Server {
|
||||
}
|
||||
|
||||
// Process all the clients (TCP)
|
||||
let mut packets: Vec<(usize, RawPacket)> = Vec::new();
|
||||
for i in 0..self.clients.len() {
|
||||
if let Some(client) = self.clients.get_mut(i) {
|
||||
match client.process().await {
|
||||
Ok(packet_opt) => {
|
||||
if let Some(raw_packet) = packet_opt {
|
||||
packets.push((i, raw_packet.clone()));
|
||||
self.parse_packet(i, raw_packet.clone()).await?;;
|
||||
}
|
||||
}
|
||||
Err(e) => client.kick(&format!("Kicked: {:?}", e)).await,
|
||||
@@ -185,10 +184,6 @@ impl Server {
|
||||
}
|
||||
}
|
||||
|
||||
for (i, packet) in packets {
|
||||
self.parse_packet(i, packet).await?;
|
||||
}
|
||||
|
||||
// I'm sorry for this code :(
|
||||
for i in 0..self.clients.len() {
|
||||
if self.clients.get(i).ok_or(ServerError::ClientDoesntExist)?.state == ClientState::Disconnect {
|
||||
|
||||
Reference in New Issue
Block a user