mirror of
https://github.com/tribufu/rust-gamedig
synced 2026-05-18 09:35:50 +00:00
[Protocol] Valve: Fix queries that require multiple challenge responses
This commit is contained in:
parent
99c87557c2
commit
e26f0f871a
2 changed files with 10 additions and 11 deletions
|
|
@ -10,6 +10,7 @@ the protocols/services, also saves storage space).
|
|||
Protocols:
|
||||
- Valve:
|
||||
1. Reversed (from `0.1.0`) "Players with no name are no more added to the `players_details` field.", also added a note in the [protocols](PROTOCOLS.md) file regarding this.
|
||||
2. Fixed querying while multiple challenge responses might happen.
|
||||
|
||||
### Breaking:
|
||||
None.
|
||||
|
|
|
|||
|
|
@ -189,21 +189,19 @@ impl ValveProtocol {
|
|||
/// Ask for a specific request only.
|
||||
fn get_request_data(&mut self, engine: &Engine, protocol: u8, kind: Request) -> GDResult<Bufferer> {
|
||||
let request_initial_packet = Packet::initial(kind).to_bytes();
|
||||
|
||||
self.socket.send(&request_initial_packet)?;
|
||||
let packet = self.receive(engine, protocol, PACKET_SIZE)?;
|
||||
|
||||
if packet.kind != 0x41 { //'A'
|
||||
let data = packet.payload.clone();
|
||||
return Ok(Bufferer::new_with_data(Endianess::Little, &data));
|
||||
let mut packet = self.receive(engine, protocol, PACKET_SIZE)?;
|
||||
while packet.kind == 0x41 {// 'A'
|
||||
let challenge = packet.payload.clone();
|
||||
let challenge_packet = Packet::challenge(kind, challenge).to_bytes();
|
||||
|
||||
self.socket.send(&challenge_packet)?;
|
||||
|
||||
packet = self.receive(engine, protocol, PACKET_SIZE)?;
|
||||
}
|
||||
|
||||
let challenge = packet.payload;
|
||||
let challenge_packet = Packet::challenge(kind, challenge).to_bytes();
|
||||
|
||||
self.socket.send(&challenge_packet)?;
|
||||
|
||||
let data = self.receive(engine, protocol, PACKET_SIZE)?.payload;
|
||||
let data = packet.payload;
|
||||
Ok(Bufferer::new_with_data(Endianess::Little, &data))
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue