pub struct ConnectionH1<Front: SocketHandler> {
pub position: Position,
pub readiness: Readiness,
pub requests: usize,
pub socket: Front,
pub stream: Option<usize>,
pub timeout_duration: Duration,
pub parked_on_buffer_pressure: bool,
pub write_failed: bool,
pub close_notify_sent: bool,
pub session_ulid: Ulid,
pub reused_from_pool: bool,
/* private fields */
}Expand description
HTTP/1.1 connection handler within the mux layer.
Manages a single HTTP/1.1 connection (either frontend or backend), handling request/response forwarding through kawa buffers. Supports keep-alive, chunked transfer encoding, close-delimited responses, and upgrade (e.g., WebSocket).
Fields§
§position: Position§readiness: Readiness§requests: usize§socket: Front§stream: Option<usize>Active stream index, or None when the connection has no assigned stream
(initial client state before start_stream, or after end_stream detaches).
timeout_duration: DurationConfigured idle timeout for this connection. The core never arms a
wheel entry itself: it publishes the next instant it wants to be called
back at through ConnectionH1::poll_timeout, and the embedder — the
Mux adapter — owns the TimeoutContainer that reflects it onto the
real timer. See LIFECYCLE.md §7.7.
parked_on_buffer_pressure: boolSet when readable exits early because the kawa buffer was full.
Edge-triggered epoll will not re-fire READABLE for data already in the
kernel socket buffer, so the cross-readiness mechanism must re-arm it
via try_resume_reading once the peer drains the buffer.
write_failed: boolA write to the client failed (reset, broken pipe or another socket error): nothing more can be flushed to it, so the connection reports no pending write and the session closes instead of waiting to flush.
close_notify_sent: boolTrue once we’ve asked rustls to emit TLS close_notify for this frontend.
session_ulid: UlidConnection/session ULID propagated from the parent super::Mux. Used to
stamp the session slot of the [session req cluster backend] log
prefix emitted by the local log_context! macro.
reused_from_pool: boolTrue once this backend connection has served a stream that it picked up out of the H1 keep-alive pool, rather than on the fresh dial that created it.
This is pingora’s client_reused bit — the provenance the protocol
layer cannot see but the retry decision needs.
It does NOT prove what the peer did. An EOF with no response is
indistinguishable at this layer from a stale pool socket, from an
origin that half-closed after processing the request but before
answering, and from one that crashed mid-request: readable treats
every size == 0 alike, and an empty back buffer proves only that no
response byte arrived. What this bit does is bound the window in
which sozu is willing to re-issue: a connection that came out of the
pool has been idle long enough for its peer to have closed it
unobserved, a freshly dialled one has not. What makes re-issuing
permissible at all is the idempotence gate (RFC 9110 §9.2.2) in
Stream::can_replay_on_fresh_upstream; this bit only narrows when
that permission is exercised, so only a reused connection arms
request capture (sozu-proxy/sozu#1442). Always false on a
Position::Server connection.