Skip to main content

serve_mux

Function serve_mux 

Source
pub fn serve_mux<M: RemoteMessage, In: RemoteMessage, Out: RemoteMessage>(
    addr: ChannelAddr,
    prebound_listener: Option<TcpListener>,
) -> Result<MuxServer<M, In, Out>, ChannelError>
Expand description

Serve a muxed listener on addr. Simplex clients (dialed via channel::dial) deliver into the bundled ChannelRx<M>; duplex clients (dialed via channel::duplex::dial) populate the bundled [DuplexServer<In, Out>]. Only net transports are supported; the caller picks transports that implement both protocol styles.

The returned MuxServer owns both halves and a shared MuxShutdown. Dropping or stopping any of these tears down the listener and the other half together — see MuxServer for the full lifecycle contract.