mirror of
https://github.com/tribufu/rust-gamedig
synced 2026-06-01 09:42:41 +00:00
Valve Protocol: Extend split packets correctly
This commit is contained in:
parent
f03a1de035
commit
9c9a096b16
2 changed files with 8 additions and 0 deletions
|
|
@ -11,6 +11,7 @@ Games:
|
||||||
|
|
||||||
Protocols:
|
Protocols:
|
||||||
- Valve: Players with no name are no more added to the `players_details` field.
|
- Valve: Players with no name are no more added to the `players_details` field.
|
||||||
|
- Valve: Split packets are now appending in the correct order.
|
||||||
|
|
||||||
Crate:
|
Crate:
|
||||||
- `MSRV` is now `1.56.1` (was `1.58.1`)
|
- `MSRV` is now `1.56.1` (was `1.58.1`)
|
||||||
|
|
|
||||||
|
|
@ -163,11 +163,18 @@ impl ValveProtocol {
|
||||||
buffer.move_position_backward(1);
|
buffer.move_position_backward(1);
|
||||||
if header == 0xFE { //the packet is split
|
if header == 0xFE { //the packet is split
|
||||||
let mut main_packet = SplitPacket::new(&app, protocol, &mut buffer)?;
|
let mut main_packet = SplitPacket::new(&app, protocol, &mut buffer)?;
|
||||||
|
let mut chunk_packets = Vec::with_capacity((main_packet.total - 1) as usize);
|
||||||
|
|
||||||
for _ in 1..main_packet.total {
|
for _ in 1..main_packet.total {
|
||||||
let new_data = self.socket.receive(Some(buffer_size))?;
|
let new_data = self.socket.receive(Some(buffer_size))?;
|
||||||
buffer = Bufferer::new_with_data(Endianess::Little, &new_data);
|
buffer = Bufferer::new_with_data(Endianess::Little, &new_data);
|
||||||
let chunk_packet = SplitPacket::new(&app, protocol, &mut buffer)?;
|
let chunk_packet = SplitPacket::new(&app, protocol, &mut buffer)?;
|
||||||
|
chunk_packets.push(chunk_packet);
|
||||||
|
}
|
||||||
|
|
||||||
|
chunk_packets.sort_by(|a, b| a.number.cmp(&b.number));
|
||||||
|
|
||||||
|
for chunk_packet in chunk_packets {
|
||||||
main_packet.payload.extend(chunk_packet.payload);
|
main_packet.payload.extend(chunk_packet.payload);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue