Skip to main content

DEFAULT_SOCKET_RECV_BUFFER

Constant DEFAULT_SOCKET_RECV_BUFFER 

Source
pub const DEFAULT_SOCKET_RECV_BUFFER: usize = _; // 2_097_152usize
Expand description

Default UDP socket receive buffer to request, in bytes.

Not a size that arrives on its own. quinn never calls setsockopt(SO_RCVBUF), so a QUIC server that does not ask keeps whatever the kernel hands out — net.core.rmem_default, around 208 KiB on a stock Linux — however high net.core.rmem_max has been raised, because that sysctl is only a ceiling on what an application may request, not an allocation.

2 MiB is cheap insurance in the same spirit as the per-stream flow-control window in crate::quic: it costs nothing until a burst needs it, and the bursts it covers are ordinary ones — a batch of packets arriving while the read loop is elsewhere, a GSO segment train, a scheduling hiccup. What it buys is the absence of a silent drop, which the kernel counts as receive buffer errors in netstat -su and the sender pays for in retransmissions.

Requested when the socket is created, so this is a startup-only setting. Zero leaves the operating system’s own value alone.