pub struct Mux<Front: SocketHandler, L: ListenerHandler + L7ListenerHandler> {
pub configured_frontend_timeout: Duration,
pub frontend_token: Token,
pub frontend: Connection<Front>,
pub router: Router,
pub context: Context<L>,
pub timeouts: MuxTimeouts,
pub session_ulid: Ulid,
/* private fields */
}Fields§
§configured_frontend_timeout: Duration§frontend_token: Token§frontend: Connection<Front>§router: Router§context: Context<L>§timeouts: MuxTimeoutsThe adapter’s wheel handles, one per live token (the frontend plus
every backend in router.backends).
The H1/H2 cores no longer own a TimeoutContainer: they publish the
instant they want to be called back at through Connection::poll_timeout
and Mux::reschedule reflects that onto crate::timer, arming only
when what the wheel holds differs from what the core wants. This map is
the ONLY thing in the mux that talks to the timer wheel.
A handle for a token that has left router.backends is dropped by
reschedule’s retain, and TimeoutContainer::drop cancels its entry
— which is why no backend-removal site has to remember to cancel.
session_ulid: UlidPer-session correlation ID generated at construction time. Included in every log line emitted from this module so all events for a single frontend connection can be reassembled (independent of the ephemeral per-stream request id used by access logs).
Implementations§
Source§impl<Front: SocketHandler, L: ListenerHandler + L7ListenerHandler> Mux<Front, L>
impl<Front: SocketHandler, L: ListenerHandler + L7ListenerHandler> Mux<Front, L>
pub fn front_socket(&self) -> &TcpStream ⓘ
Sourcepub fn take_loop_budget_yield(&mut self) -> bool
pub fn take_loop_budget_yield(&mut self) -> bool
Take the flag the last ready pass set when it yielded at
MAX_LOOP_ITERATIONS with work left (Context::loop_budget_yielded).
The session answers ProxySession::yielded with it.
Sourcepub fn has_pending_backend_failure(&self) -> bool
pub fn has_pending_backend_failure(&self) -> bool
Whether a backend connection carries a HUP or ERROR event that no
socket readiness will deliver again: the flag Mux::timeout_inner
sets on a dial whose connect timed out. The session answers
ProxySession::needs_ready_pass with this, so Server::timeout runs
the ready pass that counts the failure and fails the request over
(sozu-proxy/sozu#1800).
Sourcepub fn frontend_peer_closed(&self) -> bool
pub fn frontend_peer_closed(&self) -> bool
Whether the client has closed its side of the frontend connection, the
peer_closed argument the session’s close path hands to
shutdown_write. See Connection::peer_closed.
Trait Implementations§
Source§impl<Front: SocketHandler + Debug, L: ListenerHandler + L7ListenerHandler> SessionState for Mux<Front, L>
impl<Front: SocketHandler + Debug, L: ListenerHandler + L7ListenerHandler> SessionState for Mux<Front, L>
Source§fn ready(
&mut self,
session: Rc<RefCell<dyn ProxySession>>,
proxy: Rc<RefCell<dyn L7Proxy>>,
metrics: &mut SessionMetrics,
) -> SessionResult
fn ready( &mut self, session: Rc<RefCell<dyn ProxySession>>, proxy: Rc<RefCell<dyn L7Proxy>>, metrics: &mut SessionMetrics, ) -> SessionResult
Thin wrapper over Mux::ready_inner whose only job is to run
Mux::reschedule on the way out. ready_inner has a dozen return
sites; arming the wheel at each of them by hand is precisely the
discipline this refactor exists to remove.
Source§fn timeout(&mut self, token: Token, metrics: &mut SessionMetrics) -> StateResult
fn timeout(&mut self, token: Token, metrics: &mut SessionMetrics) -> StateResult
Thin wrapper over Mux::timeout_inner: reschedule on the way out,
then check the two properties carried over from UdpManager.
Source§fn shutting_down(&mut self) -> bool
fn shutting_down(&mut self) -> bool
Thin wrapper over Mux::shutting_down_inner: it drives frontend I/O
and can change a core deadline, so it owes the wheel a reschedule on
every exit.
Source§fn targets(&self, target: &SessionTarget) -> bool
fn targets(&self, target: &SessionTarget) -> bool
A mux session is targeted when one of its backend connections, connecting or connected, is: an H2 frontend multiplexing several clusters is targeted by each of them.