Skip to main content

read_frame

Function read_frame 

Source
pub fn read_frame<R: Read>(
    reader: &mut R,
    max_bytes: usize,
) -> AppResult<Option<Vec<u8>>>
Expand description

Read one length-delimited frame, bounded by max_bytes.

Returns Ok(None) on a clean end-of-stream observed before any length byte (the peer closed the connection between frames). A partial prefix or payload is a hard transport error.

ยงErrors

Returns a typed AppError on a truncated frame, a length above max_bytes, or any underlying read failure (cause preserved).