pub struct SessionTcpStream {
pub stream: TcpStream,
pub session_ulid: Ulid,
pub configured_peer: Option<SocketAddr>,
}Expand description
TcpStream wrapped with the owning session’s ULID. Exists so plain-TCP
frontends and backends inside the mux stack can prefix SOCKET-layer error
logs with [<session_ulid> - - -], matching what TLS-wrapped frontends
already do via FrontRustls::session_ulid.
The inner TcpStream is exposed directly so mio registration sites can
borrow it as-is; the outer type only participates in the SocketHandler
trait dispatch.
Fields§
§stream: TcpStream§session_ulid: Ulid§configured_peer: Option<SocketAddr>Peer address cached at construction. For backend-facing sockets
(created from a nonblocking connect() in Mux::dial_backend) this is
the cluster-configured backend address — reliable across ENOTCONN
after a failed handshake, which is the sharp case that motivates the
cache. For frontend-facing sockets constructed from an accepted
TcpStream, this is the client’s peer address — identical to what a
live getpeername(2) would return, but threaded through the same
plumbing for uniformity. Used as the preferred source of truth for
the peer= slot in log_socket_module_prefix, falling back to a
live lookup when None.
Implementations§
Trait Implementations§
Source§impl Debug for SessionTcpStream
impl Debug for SessionTcpStream
Source§impl SocketHandler for SessionTcpStream
impl SocketHandler for SessionTcpStream
Source§fn peer_addr(&self) -> Option<SocketAddr>
fn peer_addr(&self) -> Option<SocketAddr>
Same preference order as log_socket_module_prefix (private, so not
linked), which this type’s
I/O helpers already feed configured_peer into — one address for both
the SOCKET and MUX-* renderings of the same connection.
fn socket_read(&mut self, buf: &mut [u8]) -> (usize, SocketResult)
fn socket_write(&mut self, buf: &[u8]) -> (usize, SocketResult)
fn socket_write_vectored( &mut self, bufs: &[IoSlice<'_>], ) -> (usize, SocketResult)
fn socket_ref(&self) -> &TcpStream ⓘ
fn socket_mut(&mut self) -> &mut TcpStream ⓘ
fn protocol(&self) -> TransportProtocol
fn read_error(&self)
fn write_error(&self)
Source§fn session_ulid(&self) -> Option<Ulid>
fn session_ulid(&self) -> Option<Ulid>
log_socket_context! to render the [<session_ulid> - - -] segment
of the socket-layer log prefix, matching the format used by the
rest of the mux stack. Returns None for contextless implementations
(e.g. raw mio::TcpStream); the macro renders - in the ULID slot.fn socket_wants_write(&self) -> bool
fn socket_close(&mut self)
Source§fn socket_write_then_close(&mut self, buf: &[u8]) -> (usize, SocketResult)
fn socket_write_then_close(&mut self, buf: &[u8]) -> (usize, SocketResult)
buf, then begin the close Self::socket_close begins, and
report what Self::socket_write would for buf. Read more