pub struct UdpListenerSession { /* private fields */ }Expand description
The ProxySession backing one UDP listener. The server’s generic readiness
path drives this (UDP is not in the listen-accept arm). It owns the per-flow
connected upstream sockets and demuxes events by token.
Implementations§
Source§impl UdpListenerSession
impl UdpListenerSession
pub fn new( listener: Rc<RefCell<UdpListener>>, manager: Rc<RefCell<UdpManager>>, backends: Rc<RefCell<BackendMap>>, registry: Registry, sessions: Rc<RefCell<SessionManager>>, listener_token: Token, ) -> UdpListenerSession
Sourcepub fn close_all_flows(&mut self, now: Instant)
pub fn close_all_flows(&mut self, now: Instant)
Tear down every active flow on this listener through the manager, so
each close emits FlowEvicted + CloseFlow exactly once and the shell’s
normal on_close_flow handler frees the upstream
socket + slab slot and decrements udp.active_flows. Used on soft/hard
stop, listener remove, and listener deactivate so the worker reaches its
base_sessions_count and exits promptly instead of waiting out every
flow’s idle timeout — and so the active-flows gauge does not leak by N
(the bug the old direct-teardown path had: it cleared the shell maps
without telling the manager, so FlowEvicted never fired).
On a deactivate where the manager is retained (not dropped), this also
resets the manager’s flow table to empty, keeping manager and shell
consistent. The listener socket and the listener-session slab slot are
left intact (the listener slot is part of base_sessions_count and
reclaimed when the worker exits); only the connectionless per-flow slots
— which are NOT counted in nb_connections and so removed without
decr — are freed.
Trait Implementations§
Source§impl ProxySession for UdpListenerSession
impl ProxySession for UdpListenerSession
Source§fn update_readiness(&mut self, token: Token, events: Ready)
fn update_readiness(&mut self, token: Token, events: Ready)
Source§fn ready(&mut self, _session: Rc<RefCell<dyn ProxySession>>) -> bool
fn ready(&mut self, _session: Rc<RefCell<dyn ProxySession>>) -> bool
Source§fn timeout(&mut self, token: Token) -> bool
fn timeout(&mut self, token: Token) -> bool
Source§fn close(&mut self)
fn close(&mut self)
Source§fn last_event(&self) -> Instant
fn last_event(&self) -> Instant
Source§fn print_session(&self)
fn print_session(&self)
Source§fn frontend_token(&self) -> Token
fn frontend_token(&self) -> Token
Source§fn shutting_down(&mut self) -> bool
fn shutting_down(&mut self) -> bool
Source§fn cluster_id(&self) -> Option<String>
fn cluster_id(&self) -> Option<String>
None for ListenSession (no per-session
cluster), and for client sessions before routing has resolved.
H2 sessions multiplex many streams over one frontend token and may
touch several clusters; the returned value is whichever cluster
the session most recently keep-alive’d to. Used for log/metric
attribution, not for accounting (the tracker keeps the canonical
per-stream (cluster, IP) set).Source§fn session_address(&self) -> Option<SocketAddr>
fn session_address(&self) -> Option<SocketAddr>
peer_addr. ListenSession returns
None. Used to attribute per-(cluster, source-IP) tracking and
access logs to the real client behind a layer-4 PROXY frontend.