a73x

9243d0c0

refactor: egress_cap is an Egress tunable, not a wire agreement

a73x   2026-08-12 18:27

Commit message
refactor: egress_cap is an Egress tunable, not a wire agreement

The wire-constants banner promises numbers both ends must spell alike, and
egress_cap is not one: it sizes a LOCAL ring, while the windows a peer
actually respects arrive in the transport params. Two ends with different
ring sizes interoperate — so the constant belongs with the ring it sizes.

Moved to the top of the Egress section, above `Egress` itself. Doc unchanged;
line-multiset diff shows nothing added and nothing dropped.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

src/quic.zig
Old New
@@ -53,12 +53,6 @@ pub const psk_identity: [*:0]const u8 = "mux";
53 pub const psk_ciphersuite: [*:0]const u8 = "TLS13-AES128-GCM-SHA256"; 53 pub const psk_ciphersuite: [*:0]const u8 = "TLS13-AES128-GCM-SHA256";
54 pub const alpn = "\x03mux"; 54 pub const alpn = "\x03mux";
55 55
56 /// How many outbound bytes one connection may hold. Sized to the stream
57 /// window the peer advertises, because holding much more than the peer will
58 /// let us send buys nothing: past this the daemon's own `pending_cap` is the
59 /// right place for the backlog to sit and be judged.
60 pub const egress_cap = 256 * 1024;
61
62 // --------------------------------------------------------------------------- 56 // ---------------------------------------------------------------------------
63 // The pre-shared key 57 // The pre-shared key
64 // --------------------------------------------------------------------------- 58 // ---------------------------------------------------------------------------
@@ -239,6 +233,12 @@ test "Key.load: refuses a permissive mode, a missing file, and a bad length" {
239 // Egress: the ring, and what one writev_stream return means for it 233 // Egress: the ring, and what one writev_stream return means for it
240 // --------------------------------------------------------------------------- 234 // ---------------------------------------------------------------------------
241 235
236 /// How many outbound bytes one connection may hold. Sized to the stream
237 /// window the peer advertises, because holding much more than the peer will
238 /// let us send buys nothing: past this the daemon's own `pending_cap` is the
239 /// right place for the backlog to sit and be judged.
240 pub const egress_cap = 256 * 1024;
241
242 /// Outbound stream bytes, in a ring that never moves a byte once written. 242 /// Outbound stream bytes, in a ring that never moves a byte once written.
243 /// 243 ///
244 /// A ring rather than a growable buffer, because ngtcp2 does NOT copy stream 244 /// A ring rather than a growable buffer, because ngtcp2 does NOT copy stream