mirror of
https://github.com/tribufu/rust-gamedig
synced 2026-05-06 15:27:28 +00:00
[Protocol] Quake change get response header to str
This commit is contained in:
parent
3a9bd77efe
commit
596d15df78
4 changed files with 8 additions and 8 deletions
|
|
@ -11,7 +11,7 @@ pub(crate) trait QuakeClient {
|
|||
type Player;
|
||||
|
||||
fn get_send_header<'a>() -> &'a str;
|
||||
fn get_response_header<'a>() -> &'a[u8];
|
||||
fn get_response_header<'a>() -> &'a str;
|
||||
fn parse_player_string(data: Iter<&str>) -> GDResult<Self::Player>;
|
||||
}
|
||||
|
||||
|
|
@ -28,7 +28,7 @@ fn get_data<Client: QuakeClient>(address: &IpAddr, port: u16, timeout_settings:
|
|||
return Err(GDError::PacketBad);
|
||||
}
|
||||
|
||||
let response_header = Client::get_response_header();
|
||||
let response_header = Client::get_response_header().as_bytes();
|
||||
if !bufferer.remaining_data().starts_with(response_header) {
|
||||
Err(GDError::PacketBad)?
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@ impl QuakeClient for QuakeOne {
|
|||
"status"
|
||||
}
|
||||
|
||||
fn get_response_header<'a>() -> &'a [u8] {
|
||||
"n".as_bytes()
|
||||
fn get_response_header<'a>() -> &'a str {
|
||||
"n"
|
||||
}
|
||||
|
||||
fn parse_player_string(mut data: Iter<&str>) -> GDResult<Self::Player> {
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ impl QuakeClient for QuakeThree {
|
|||
"getstatus"
|
||||
}
|
||||
|
||||
fn get_response_header<'a>() -> &'a [u8] {
|
||||
"statusResponse\n".as_bytes()
|
||||
fn get_response_header<'a>() -> &'a str {
|
||||
"statusResponse\n"
|
||||
}
|
||||
|
||||
fn parse_player_string(data: Iter<&str>) -> GDResult<Self::Player> {
|
||||
|
|
|
|||
|
|
@ -25,8 +25,8 @@ impl QuakeClient for QuakeTwo {
|
|||
QuakeOne::get_send_header()
|
||||
}
|
||||
|
||||
fn get_response_header<'a>() -> &'a [u8] {
|
||||
"print\n".as_bytes()
|
||||
fn get_response_header<'a>() -> &'a str {
|
||||
"print\n"
|
||||
}
|
||||
|
||||
fn parse_player_string(mut data: Iter<&str>) -> GDResult<Self::Player> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue