Skip to main content

MAX_MESSAGE_SIZE

Constant MAX_MESSAGE_SIZE 

Source
pub const MAX_MESSAGE_SIZE: u32 = _ /* 16_777_216u32 */;
Expand description

Maximum framed message size. Pinned at exactly 16 MiB by ADR 013 §Wire Framing, uniformly across all ALPNs in v1.

The ceiling is a pre-allocation denial-of-service bound: read_frame allocates exactly len bytes after decoding the length prefix, so an unbounded length would let a peer force arbitrary-sized allocations. 16 MiB sits well above every documented ALPN message (cdn/probe/v1 ≤ ~200 B, cdn/client/v1 non-ChunkData ≤ ~1 KiB) and pairs with QUIC’s MAX_STREAMS (ADR 005) for the total per-peer memory bound.

Changing this constant is a protocol-wide wire-compatibility decision — any edit, whether bump or shrink, requires an ADR 013 amendment first. The compile-time guard below catches accidental edits. Per-deployment tightening for memory-constrained nodes is a runtime-config concern (ADR 013 §Wire Framing), not a change to the constant itself.