Skip to content

Commit

Permalink
fix(protocol): clean up addr match in epic
Browse files Browse the repository at this point in the history
  • Loading branch information
cainthebest committed Oct 11, 2024
1 parent ac65c04 commit 2ade7f9
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions crates/lib/src/protocols/epic/protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,19 +123,12 @@ impl EpicProtocol {
.get("attributes")
.ok_or(PacketBad.context("Expected attributes field missing in sessions."))?;

let address_match = attributes
let full_address_match = attributes
.get("ADDRESSBOUND_s")
.and_then(Value::as_str)
.map_or(false, |v| {
v == format!("0.0.0.0:{}", port) || v == format!("{}:{}", address, port)
});
.map_or(false, |v| v == address || v == format!("0.0.0.0:{}", port));

let port_match = attributes
.get("GAMESERVER_PORT_l")
.and_then(Value::as_u64)
.map_or(false, |v| v == port as u64);

if address_match && port_match {
if full_address_match {
return Ok(session);
}
}
Expand Down

0 comments on commit 2ade7f9

Please sign in to comment.