Skip to main content

check_version

Function check_version 

Source
pub fn check_version(v: u16, negotiated: Option<u16>) -> Result<(), ErrorBody>
Expand description

Checks an inbound envelope’s v against the connection’s negotiated version.

After negotiation v MUST equal it; otherwise UNSUPPORTED_VERSION with this crate’s range (VersionRange::CURRENT). Before negotiation any v passes: only session.hello is answered then (anything else gets HELLO_REQUIRED), and its versions body decides.

§Errors

UNSUPPORTED_VERSION when v differs from the negotiated version.