mirror of
https://github.com/tribufu/rust-gamedig
synced 2026-06-01 09:42:41 +00:00
Fix: match port on epic protocol (#225)
This commit is contained in:
parent
344622629e
commit
e4baf07e48
1 changed files with 11 additions and 9 deletions
|
|
@ -122,22 +122,24 @@ impl EpicProtocol {
|
||||||
let attributes = session
|
let attributes = session
|
||||||
.get("attributes")
|
.get("attributes")
|
||||||
.ok_or(PacketBad.context("Expected attributes field missing in sessions."))?;
|
.ok_or(PacketBad.context("Expected attributes field missing in sessions."))?;
|
||||||
if attributes
|
|
||||||
|
let address_match = attributes
|
||||||
.get("ADDRESSBOUND_s")
|
.get("ADDRESSBOUND_s")
|
||||||
.and_then(Value::as_str)
|
.and_then(Value::as_str)
|
||||||
.map_or(false, |v| {
|
.map_or(false, |v| v == address || v == format!("0.0.0.0:{}", port))
|
||||||
v.contains(&address) || v.contains(&port.to_string())
|
|
||||||
})
|
|
||||||
|| attributes
|
|| attributes
|
||||||
.get("ADDRESS_s")
|
.get("GAMESERVER_PORT_1")
|
||||||
.and_then(Value::as_str)
|
.and_then(Value::as_u64)
|
||||||
.map_or(false, |v| v.contains(&address))
|
.map_or(false, |v| v == port as u64);
|
||||||
{
|
|
||||||
|
if address_match {
|
||||||
return Ok(session);
|
return Ok(session);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Err(PacketBad.context("Servers were provided but the specified one couldn't be find amonst them."));
|
return Err(
|
||||||
|
PacketBad.context("Servers were provided but the specified one couldn't be found amongst them.")
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Err(PacketBad.context("Expected session field to be an array."))
|
Err(PacketBad.context("Expected session field to be an array."))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue