mirror of
https://github.com/tribufu/rust-gamedig
synced 2026-06-01 09:42:41 +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:
|
Protocols:
|
||||||
- Valve:
|
- 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.
|
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:
|
### Breaking:
|
||||||
None.
|
None.
|
||||||
|
|
|
||||||
|
|
@ -189,21 +189,19 @@ impl ValveProtocol {
|
||||||
/// Ask for a specific request only.
|
/// Ask for a specific request only.
|
||||||
fn get_request_data(&mut self, engine: &Engine, protocol: u8, kind: Request) -> GDResult<Bufferer> {
|
fn get_request_data(&mut self, engine: &Engine, protocol: u8, kind: Request) -> GDResult<Bufferer> {
|
||||||
let request_initial_packet = Packet::initial(kind).to_bytes();
|
let request_initial_packet = Packet::initial(kind).to_bytes();
|
||||||
|
|
||||||
self.socket.send(&request_initial_packet)?;
|
self.socket.send(&request_initial_packet)?;
|
||||||
let packet = self.receive(engine, protocol, PACKET_SIZE)?;
|
|
||||||
|
|
||||||
if packet.kind != 0x41 { //'A'
|
let mut packet = self.receive(engine, protocol, PACKET_SIZE)?;
|
||||||
let data = packet.payload.clone();
|
while packet.kind == 0x41 {// 'A'
|
||||||
return Ok(Bufferer::new_with_data(Endianess::Little, &data));
|
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 data = 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;
|
|
||||||
Ok(Bufferer::new_with_data(Endianess::Little, &data))
|
Ok(Bufferer::new_with_data(Endianess::Little, &data))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue