Skip to main content

stop_on_invalid_header

Function stop_on_invalid_header 

Source
pub(crate) fn stop_on_invalid_header<const C: usize>(
    messages: impl Stream<Item = Result<SessionMessage<C>, SessionError>>,
) -> impl Stream<Item = Result<SessionMessage<C>, SessionError>>
Expand description

End the incoming session stream after reporting an untrusted header once.

There is no synchronization marker to safely locate the next message after a wrong version or an impossible length. These errors are terminal; errors in a message with a known boundary remain recoverable because the decoder has already consumed that message.