Skip to main content

ChecklistSet

Struct ChecklistSet 

Source
pub struct ChecklistSet { /* private fields */ }
Expand description

The ordered set of checklists, one per data stream (§6.1.2, §6.1.2.6).

Implementations§

Source§

impl ChecklistSet

Source

pub fn new() -> Self

An empty set.

Source

pub fn push(&mut self, checklist: Checklist)

Append a checklist. The order is the “usage-defined checklist set order” §6.1.2.6 unfreezes against.

Source

pub fn checklists(&self) -> &[Checklist]

The checklists, in order.

Source

pub fn checklists_mut(&mut self) -> &mut [Checklist]

The checklists, mutably.

Source

pub fn is_empty(&self) -> bool

Whether the set holds no checklists at all.

Source

pub fn pair(&self, id: PairId) -> Option<&CandidatePair>

The pair with this identity, wherever it is.

Source

pub fn pair_mut(&mut self, id: PairId) -> Option<&mut CandidatePair>

The pair with this identity, mutably.

Source

pub fn checklist_of(&self, id: PairId) -> Option<usize>

Which checklist holds this pair.

Source

pub fn total_pairs(&self) -> usize

N in §14.3’s RTO: the total number of connectivity checks to be performed.

Source

pub fn outstanding(&self) -> usize

Num-Waiting + Num-In-Progress in §14.3’s RTO, across the set.

Source

pub fn limit(&mut self, limit: usize)

§6.1.2.5: discard the lowest-priority pairs until the set holds at most limit of them.

The limit is an attack control and not tidiness — it bounds how many packets a hostile candidate list can make sipx send — which is why §6.1.2.5 makes it a MUST and makes it configurable. The discarding is spread across checklists (“SHOULD be done evenly so that the number of candidate pairs in each checklist is reduced the same amount”) by always taking from the longest checklist.

Only pairs that have not been checked, or have finished failing, are discardable. §6.1.2.5 runs at checklist formation, when every pair is Frozen; this runs again every time §7.3.1.4 inserts a pair, because that is the path a peer can drive. Discarding an In-Progress pair would orphan its transaction, and discarding a Succeeded one would take a working path out of the valid list — so a set already full of live pairs stops shrinking rather than tearing itself down, and the limit then binds by refusing growth.

Source

pub fn compute_initial_states(&mut self)

§6.1.2.6’s initial states: everything Frozen, every checklist Running, and then exactly one pair per foundation moved to Waiting.

The pair to unfreeze is “the first candidate pair (ordered by the lowest component ID and then the highest priority if component IDs are equal) in the first checklist … that has that foundation”, and a foundation already unfrozen in an earlier checklist is not unfrozen again. RFC 8445’s own Table 1 walks the case that distinguishes this from RFC 5245’s rule, and the_rfcs_three_checklist_five_foundation_example_unfreezes_five_pairs asserts it cell by cell.

Source

pub fn unfreeze_added(&mut self)

§6.1.2, applied to a set that has grown: “if candidates are added to a checklist … the agent will re-perform these steps for the updated checklist”.

The same rule as §6.1.2.6 step 4, expressed over whatever is Frozen now: for each foundation that has no pair anywhere in the set outside the Frozen state, the first Frozen pair with it — by lowest component ID, then highest priority, in the first checklist that has it — moves to Waiting. Run over a set where everything is Frozen this is step 4; run over a live set it unfreezes exactly the foundations the new pairs brought.

Source

pub fn unfreeze_foundation(&mut self, foundation: &PairFoundation)

§7.2.5.3.3: every Frozen pair in every checklist that shares this foundation moves to Waiting.

Source

pub fn unfreeze_idle(&mut self, index: usize)

§6.1.4.2 step 2: with nothing Waiting in this checklist and something Frozen in it, unfreeze the Frozen pairs whose foundation has no pair Waiting or In-Progress anywhere in the set.

This is the second unfreeze trigger, and the one that is easy to miss. Without it, a foundation whose one unfrozen pair failed leaves its remaining pairs Frozen for the rest of the session — §6.1.2.6 unfreezes each foundation exactly once, and §7.2.5.3.3 only ever unfreezes on success — so ICE reports a failure for a path it never finished checking.

Source

pub fn next_active(&mut self) -> Option<usize>

The next checklist Ta may act on, round-robin (§6.1.4.2).

“Whenever Ta fires the next checklist in the Running state in the checklist set is picked … After the last checklist in the Running state has been processed, the first checklist is picked again.” A Completed checklist is included when it still has a triggered check queued, because §8.1.2 requires an agent to keep answering for a concluded stream and §8.1.1’s tolerance clause depends on it.

Source

pub fn recompute_priorities( &mut self, role: Role, locals: &[LocalCandidate], remotes: &[RemoteCandidate], )

Recompute every pair priority and re-sort every checklist (§6.1.2.3).

A role change swaps which side is G and which is D, so this runs on every role change — forgetting it is one of the two ways role conflict is mishandled, and the other is not detecting the conflict at all.

Trait Implementations§

Source§

impl Debug for ChecklistSet

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ChecklistSet

Source§

fn default() -> ChecklistSet

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,