Skip to main content

read_frame

Function read_frame 

Source
pub async fn read_frame<R: AsyncRead + Unpin>(
    r: &mut R,
) -> Result<Vec<u8>, FrameError>
Expand description

Read one length-prefixed frame from an async reader.

The length prefix is validated against MAX_MESSAGE_SIZE before any payload allocation, so a malicious peer cannot trigger a large allocation by sending a single oversized varint.