Skip to main content

read_frame_within

Function read_frame_within 

Source
pub async fn read_frame_within<R: AsyncRead + Unpin>(
    r: &mut R,
    max_bytes: u32,
) -> Result<Frame, CodecError>
Expand description

read_frame with a caller-supplied maximum, checked against the length prefix BEFORE any allocation. The auth phase passes a tight bound so an unauthenticated peer cannot force the full MAX_FRAME_BYTES allocation with its first frame (#881) — the frame-level cap is what actually bounds the pre-auth allocation, since the body is sized from the length prefix.