mirror of
https://github.com/tribufu/rust-gamedig
synced 2026-05-06 07:17:27 +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
|
||||
.get("attributes")
|
||||
.ok_or(PacketBad.context("Expected attributes field missing in sessions."))?;
|
||||
if attributes
|
||||
|
||||
let address_match = attributes
|
||||
.get("ADDRESSBOUND_s")
|
||||
.and_then(Value::as_str)
|
||||
.map_or(false, |v| {
|
||||
v.contains(&address) || v.contains(&port.to_string())
|
||||
})
|
||||
.map_or(false, |v| v == address || v == format!("0.0.0.0:{}", port))
|
||||
|| attributes
|
||||
.get("ADDRESS_s")
|
||||
.and_then(Value::as_str)
|
||||
.map_or(false, |v| v.contains(&address))
|
||||
{
|
||||
.get("GAMESERVER_PORT_1")
|
||||
.and_then(Value::as_u64)
|
||||
.map_or(false, |v| v == port as u64);
|
||||
|
||||
if address_match {
|
||||
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."))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue