mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2026-10-25 13:30:43 +00:00
Update mod.rs
This commit is contained in:
1 parent
190cc8f238
commit
3fedcf5bd5
1 file changed
+1
-6
+1
-6
@@ -161,13 +161,12 @@ impl Server {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Process all the clients (TCP)
|
// Process all the clients (TCP)
|
||||||
let mut packets: Vec<(usize, RawPacket)> = Vec::new();
|
|
||||||
for i in 0..self.clients.len() {
|
for i in 0..self.clients.len() {
|
||||||
if let Some(client) = self.clients.get_mut(i) {
|
if let Some(client) = self.clients.get_mut(i) {
|
||||||
match client.process().await {
|
match client.process().await {
|
||||||
Ok(packet_opt) => {
|
Ok(packet_opt) => {
|
||||||
if let Some(raw_packet) = 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,
|
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 :(
|
// I'm sorry for this code :(
|
||||||
for i in 0..self.clients.len() {
|
for i in 0..self.clients.len() {
|
||||||
if self.clients.get(i).ok_or(ServerError::ClientDoesntExist)?.state == ClientState::Disconnect {
|
if self.clients.get(i).ok_or(ServerError::ClientDoesntExist)?.state == ClientState::Disconnect {
|
||||||
|
|||||||
Reference in new issue
Block a user