Skip to content

Commit

Permalink
Look for candidate with highest priority
Browse files Browse the repository at this point in the history
  • Loading branch information
thomaseizinger authored and algesten committed Oct 7, 2024
1 parent 047ff61 commit 5c4c9d5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/ice/agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1242,7 +1242,8 @@ impl IceAgent {
.remote_candidates
.iter()
.enumerate()
.find(|(_, c)| !c.discarded() && c.proto() == req.proto && c.addr() == req.source);
.filter(|(_, c)| !c.discarded() && c.proto() == req.proto && c.addr() == req.source)
.max_by_key(|(_, c)| c.prio()); // We may have multiple candidates with the same address (i.e. host and server-reflexive could be the same).

let remote_idx = if let Some((idx, _)) = found_in_remote {
trace!("Remote candidate for STUN request found");
Expand Down

0 comments on commit 5c4c9d5

Please sign in to comment.