Skip to main content

check_no_duplicate_parameters_received

Function check_no_duplicate_parameters_received 

Source
fn check_no_duplicate_parameters_received(
    parameters: &[KeyValuePair],
    known: &[u64],
) -> Result<(), CodecError>
Expand description

Refuse a received parameter list that repeats a type this draft names.

The receiver’s half of the same sentence is narrower, and deliberately so. Section 9.2: “Receivers SHOULD check that there are no unauthorized duplicate parameters and close the session as a PROTOCOL_VIOLATION if found. Receivers MUST allow duplicates of unknown parameters.”

So a repeat of a type in known is refused, and a repeat of any other type is carried. Mirroring the sender’s check here instead would close sessions over frames a conforming peer is entitled to send — an extension parameter this codec does not know may legitimately repeat, and its own definition, not this one, says whether it may.

Code that scans a parameter list for a key takes whichever copy it meets first, so one frame carrying two values for one named type is read differently by two conforming implementations. That is what the refusal is for, and it is also why it stops at the types whose meaning is fixed here.