pub enum Connection<Front: SocketHandler> {
H1(ConnectionH1<Front>),
H2(H2Shell<Front>),
}Variants§
H1(ConnectionH1<Front>)
H2(H2Shell<Front>)
Implementations§
Source§impl<Front: SocketHandler> Connection<Front>
impl<Front: SocketHandler> Connection<Front>
pub fn new_h1_server( session_ulid: Ulid, front_stream: Front, timeout_duration: Duration, ) -> Connection<Front>
pub fn new_h1_client( session_ulid: Ulid, front_stream: Front, cluster_id: ClusterId, backend: BackendId, timeout_duration: Duration, ) -> Connection<Front>
pub fn new_h2_server( session_ulid: Ulid, front_stream: Front, buffers: &mut dyn BufferSource, timeout_duration: Duration, flood_config: H2FloodConfig, connection_config: H2ConnectionConfig, stream_idle_timeout: Duration, graceful_shutdown_deadline: Option<Duration>, ) -> Option<Connection<Front>>
pub fn new_h2_client( session_ulid: Ulid, front_stream: Front, cluster_id: ClusterId, backend: BackendId, buffers: &mut dyn BufferSource, timeout_duration: Duration, flood_config: H2FloodConfig, connection_config: H2ConnectionConfig, stream_idle_timeout: Duration, graceful_shutdown_deadline: Option<Duration>, ) -> Option<Connection<Front>>
pub fn readiness(&self) -> &Readiness
pub fn readiness_mut(&mut self) -> &mut Readiness
pub fn position(&self) -> &Position
Sourcepub fn peer_closed(&self) -> bool
pub fn peer_closed(&self) -> bool
Whether the peer has closed its side of this connection: its readiness
carries Ready::HUP, recorded by epoll (EPOLLRDHUP/EPOLLHUP, see
Ready::from(&mio::event::Event)) or, on an H1 backend, by a read that
met the EOF or a reset (ConnectionH1::readable).
A backend that sozu itself is dropping does not count:
force_disconnect writes HUP into the readiness of a live backend
and marks it BackendStatus::Disconnecting, so that state is excluded
and its peer keeps its shutdown(SHUT_WR) (see mux::shutdown_write).
pub fn position_mut(&mut self) -> &mut Position
pub fn socket(&self) -> &TcpStream ⓘ
pub fn socket_mut(&mut self) -> &mut TcpStream ⓘ
Sourcepub fn socket_handler_mut(&mut self) -> &mut Front
pub fn socket_handler_mut(&mut self) -> &mut Front
The socket handler itself, for what only it knows how to record:
FrontRustls::readiness_delivered (lib/src/https.rs).
Sourcepub fn peer_address(&self) -> Option<SocketAddr>
pub fn peer_address(&self) -> Option<SocketAddr>
The peer address this connection snapshotted at construction —
ConnectionH1::peer_address / ConnectionH2::peer_address, the single
SocketHandler::peer_addr read taken on its whole lifetime.
The one accessor Mux’s own log macros were missing. Without it the
only route from a Connection to a peer address was socket, which
hands back a concrete &mio::net::TcpStream whose inherent
peer_addr wins method resolution over the trait — a live
getpeername(2) that answers ENOTCONN once the peer resets and
reports the transport source rather than a PROXY-advertised client. So
a MUX line disagreed with the MUX-H1 / MUX-H2 / SOCKET / HTTPS
lines of the very same session.
Reads the field rather than calling the trait again, so rendering a
MUX line costs no socket access at all and cannot drift from what the
per-protocol envelopes print for the same session.
This is the sole reader of ConnectionH2::peer_address outside
lib/src/protocol/mux/h2.rs, and the only reason that field is
pub(super) rather than private — the visibility
ConnectionH1::peer_address already carried.
Sourcepub fn poll_timeout(&self) -> Option<Instant>
pub fn poll_timeout(&self) -> Option<Instant>
The next instant this connection wants timeout() called at, or
None for “no timer”.
This replaced timeout_container(), which handed the caller the wheel
handle itself. The cores no longer own one: they publish a deadline and
the Mux adapter owns every TimeoutContainer, so there is exactly one
place that talks to crate::timer and exactly one place that can get
the arm / re-arm discipline wrong. See LIFECYCLE.md §7.7.
Sourcepub fn timeout_duration(&self) -> Duration
pub fn timeout_duration(&self) -> Duration
The configured idle timeout, carried so the adapter’s container keeps a
current duration() for whoever inherits it (the WebSocket upgrade
hands it to Pipe, which re-arms from it).
Sourcepub fn arm_timeout(&mut self, now: Instant)
pub fn arm_timeout(&mut self, now: Instant)
Push the deadline one full duration out from now. Replaces
timeout_container().set(token) / .reset() at the adapter’s sites.
Sourcepub fn clear_timeout(&mut self)
pub fn clear_timeout(&mut self)
Ask for no timer at all. Replaces timeout_container().cancel().
Sourcepub fn set_timeout_duration(&mut self, duration: Duration, now: Instant)
pub fn set_timeout_duration(&mut self, duration: Duration, now: Instant)
Adopt a new configured duration and re-arm from now. Replaces
timeout_container().set_duration(d).
Sourcepub fn overhead_bytes(&self) -> (usize, usize)
pub fn overhead_bytes(&self) -> (usize, usize)
Returns connection-level byte overhead (bin, bout) for H2, (0, 0) for H1.