pub struct OutgoingMultiChannel<P, R> { /* private fields */ }
Expand description
An OutgoingMultiChannel
is established for each outgoing TCP connection.
The local party will be the client of the remote server.
The mux
part listens to multiple sessions initiated by this side and
relay their messages to the common outgoing channel.
The demux
part listens to the incoming replies from the server on the
connection and dispatches the messages to their corresponding protocol
handlers.
Implementations§
Source§impl<P: Ord + Copy, R: 'static + Send + Sync> OutgoingMultiChannel<P, R>
impl<P: Ord + Copy, R: 'static + Send + Sync> OutgoingMultiChannel<P, R>
Sourcepub fn new(
tx: Sender<MultiMessage<P, R>>,
rx: Receiver<MultiMessage<P, R>>,
) -> Self
pub fn new( tx: Sender<MultiMessage<P, R>>, rx: Receiver<MultiMessage<P, R>>, ) -> Self
Create a new MultiChannel
by passing it the channels it can use to
send/receive messages to/from the underlying network connection.
Sourcepub fn control(&self) -> Control<P, R>
pub fn control(&self) -> Control<P, R>
Get a handler that can be used to send signals to the channel.
Call this before the channel is run.
Sourcepub async fn run(self)
pub async fn run(self)
Start consuming messages from the remote server, relaying them to the local client side of the protocols.
We must also listen to an internal channel that signals the abortion of the whole connection due to some protocol violation.
Yet another internal channel must be used to receive registration requests.