pub struct Limits {Show 25 fields
pub max_header_bytes: u64,
pub max_concurrent_uni_streams: u32,
pub max_concurrent_bidi_streams: u32,
pub stream_receive_window: u64,
pub connection_receive_window: u64,
pub keep_alive: Duration,
pub idle_timeout: Duration,
pub hello_timeout_ms: u64,
pub max_subscriptions: usize,
pub subscriber_buffer_bytes: usize,
pub max_sequence_scopes: usize,
pub max_reorder_hold: usize,
pub max_local_streams: usize,
pub max_parked_reverse: usize,
pub max_dedup_entries: usize,
pub datagram_receive_bytes: usize,
pub datagram_send_bytes: usize,
pub path_report: bool,
pub max_flows: usize,
pub flow_queue_bytes: usize,
pub flow_early_bytes: usize,
pub flow_early_hold: Duration,
pub congestion: Congestion,
pub header_timeout_ms: u64,
pub max_header_streams: usize,
}Expand description
Resource limits applied to one connection.
Fields§
§max_header_bytes: u64Largest frame header this side will accept, in bytes. Checked against the preamble length before any allocation.
max_concurrent_uni_streams: u32QUIC concurrent inbound unidirectional streams. Bounds the number of live per-stream parse tasks for one-way transfers.
max_concurrent_bidi_streams: u32QUIC concurrent inbound bidirectional streams; bounds live request
exchanges per connection and, with max_header_bytes, worst-case
header memory.
stream_receive_window: u64QUIC per-stream receive window in bytes. Bounds buffered payload for one transfer and provides backpressure to the sender.
connection_receive_window: u64QUIC per-connection receive window in bytes.
keep_alive: DurationQUIC keep-alive interval. Sent by the dialling side only, so a binding’s value is not used.
idle_timeout: DurationQUIC idle timeout, applied in both directions.
hello_timeout_ms: u64How long to wait for the peer HELLO before closing the connection with
NEGOTIATION_FAILED, in milliseconds.
max_subscriptions: usizeSubscription filters one peer connection may hold at once, summed over
every path. Exceeding it closes the connection with LIMIT_EXCEEDED:
SUBSCRIBE has no stream to answer with an ERROR frame.
subscriber_buffer_bytes: usizePayload bytes a publisher may hold queued for one subscriber. A message that does not fit is dropped for that subscriber and counted; the publisher never blocks on a slow consumer.
max_sequence_scopes: usizeProducer scopes — paths and topics — a receiver tracks per connection
for gap detection or reassembly, when PerProducer ordering is
negotiated. The peer chooses the scope names, so the table needs a
ceiling; at the cap a new scope is simply not tracked, no gap is
reported for it and nothing is held back for it.
max_reorder_hold: usizeTransfers a receiver may hold back at once, summed over scopes, when
PerProducer(reassemble) ordering is negotiated. A held transfer is
an unread stream, so the bytes it pins are quinn’s — up to
stream_receive_window for it and connection_receive_window for the
hold as a whole. At the cap the oldest held transfer is released out
of order with its gap reported, never held in a growing buffer.
max_local_streams: usizeLive transfers on one local connection, where the OS connection
is the stream and there is no multiplexing
(decisions/0010
§4.2). Windows caps named-pipe instances at 1-255, which is the
tightest platform limit and therefore the one the default respects;
an open at the cap waits for a live transfer to end, exactly as a
QUIC open waits on the peer’s stream budget, rather than refusing.
A peer configured with zero can therefore open nothing and waits
until its caller’s deadline, exactly as one granted no QUIC streams.
Each local stream is a file descriptor on AF_UNIX (a handle on
a named pipe), on each side, besides the connection’s own. QUIC is not
affected: all its streams share one UDP socket. macOS starts a
process with a soft limit of 256 descriptors, which the default alone
nearly fills, and a process that holds both ends overruns it with
EMFILE; such a process raises RLIMIT_NOFILE or lowers this limit.
max_parked_reverse: usizeConnections a subscriber parks toward a peer it dialled, so that peer
can open a stream back
(decisions/0012
§4.4). An accepted socket cannot be dialled, so fan-out over a local
socket transport rides connections the subscriber opened and left
waiting; each is a file descriptor held for a copy that may never
come, and each counts against max_local_streams on both sides. A
publisher that finds none parked drops that copy and counts it, the
same answer fan-out already gives an exhausted subscriber budget. Zero
disables the pool, which makes a subscription over such a transport an
error at subscribe time rather than a silence.
max_dedup_entries: usizeIdentities a receiver remembers per connection for Bounded
deduplication. The window bounds how long an identity is kept, not
how many arrive within it, so the count needs its own ceiling; at the
cap the oldest entry is evicted, which costs suppression rather than
memory.
datagram_receive_bytes: usizeBytes of a peer’s QUIC datagrams buffered unread per connection,
oldest dropped first. Zero turns flows off: the connection then
advertises neither capability code 1 nor max_datagram_frame_size,
buffers nothing and runs no datagram reader
(decisions/0034 §4.5).
DEFAULT_DATAGRAM_RECEIVE_BYTES is the documented value for turning
them on.
datagram_send_bytes: usizeBytes of datagrams queued for sending per connection on QUIC, and per flow on a local transport; beyond it the oldest queued one is discarded. Bounds what this side holds for a peer that reads slowly.
path_report: boolWhether this side lists capability code 2 on a QUIC connection, so
that when the peer lists it too each side sends the other its view of
the path every 2 s and keeps the peer’s latest record, read as
ConnectionStats::remote
(decisions/0036
§4.5). Off by default; a local transport never lists it.
max_flows: usizeInbound flows one connection may hold live. Each is a FLOW stream the
peer opened and a ring this side keeps; a FLOW beyond it is stopped
with LIMIT_EXCEEDED.
flow_queue_bytes: usizeUnread datagram bytes held per inbound flow; a consumer that falls behind loses its oldest datagrams, counted per flow.
flow_early_bytes: usizeBytes of datagrams held per connection for flow ids with no live flow yet — a datagram can overtake its FLOW header — and the one place a peer can make this side hold datagrams it never registered.
flow_early_hold: DurationHow long a datagram waits in that ring for its FLOW header before it is dropped and counted.
congestion: CongestionThe congestion controller of this profile’s QUIC connections. Not a bound, but a per-connection choice, which is why it lives here: a bulk profile that shares a bottleneck with media may want a different controller than a media profile (decisions/0034 §6).
header_timeout_ms: u64How long one inbound stream may take to deliver its preamble and then
its header, each read counted from the moment a header slot was free
for it, in milliseconds. A stream that stalls inside its frame head
is stopped with CANCELED at the deadline and the connection
survives: the peer opened a stream and then said nothing, which holds
a unit of its stream credit and a task for as long as it likes
otherwise, and the QUIC idle timer does not help against a peer that
keeps the connection alive with its own pings. The wait for the
peer’s HELLO is not counted (Limits::hello_timeout_ms bounds it).
max_header_streams: usizeInbound streams one connection may have reading their frame head at
once, and at least one; the rest wait for a free slot without holding
a buffer. A head is read, decoded and its raw bytes dropped inside one
slot, so with max_header_bytes this is the worst case of header
memory per connection (Limits::worst_case_header_memory),
independent of how many streams the peer’s stream budget lets it open
and of what they do once their head is read.
Implementations§
Source§impl Limits
impl Limits
Sourcepub const fn header_slots(&self) -> usize
pub const fn header_slots(&self) -> usize
Inbound streams that may read a frame head at once: the configured
Limits::max_header_streams, and never fewer than one, because a
connection that read no head could serve nothing.
Sourcepub const fn worst_case_header_memory(&self) -> u64
pub const fn worst_case_header_memory(&self) -> u64
Worst-case memory a single hostile connection can pin in raw frame-head bytes, in bytes.
A stream holds a frame head in memory only while it holds one of the
Limits::header_slots slots: the bytes are decoded and dropped
before the slot is given back. So at most that many heads are in
memory at once, however many streams the peer opens (up to its stream
budgets, uni and bidi) and whatever those streams do after their
head: wait on a full queue, or live as long as a FLOW or REPORT stream
does. A buffer grows with the bytes that actually arrive, so the bound
is the header cap times the smaller of the slots and the stream
budgets.
What a stream keeps after its head is decoded is not counted here: the
decoded header, whose text fields have caps of their own (a few KiB at
most, docs/PROTOCOL.md §10), is part of the stream’s state, which the
stream budgets bound.