Skip to main content

pair_priority

Function pair_priority 

Source
pub fn pair_priority(controlling: Priority, controlled: Priority) -> u64
Expand description

§6.1.2.3’s pair priority, with controlling the priority of the controlling agent’s candidate and controlled the controlled agent’s:

pair priority = 2^32*MIN(G,D) + 2*MAX(G,D) + (G>D?1:0)

It fits in a u64 because Priority is bounded at 2^31 − 1: the largest value two in-range priorities produce is 2^63 − 2, at G = D = 2^31 − 1, where the G>D term is zero. That bound is spec §6.2’s, and the range check that supplies it lives in sipx-sdp, on parse — an unchecked ten-digit priority from a peer overflows this expression and silently reorders the checklist that computing it exists to order.