circuit::multi_stream

Function multi_stream_node_connection

Source
pub fn multi_stream_node_connection(
    node: &Node,
    reader: Reader,
    writer: Writer,
    is_server: bool,
    quality: Quality,
    stream_errors_out: UnboundedSender<Error>,
    remote_name: String,
) -> impl Future<Output = Result<()>> + Send
Expand description

Creates a new connection to a circuit node, and merges all streams produced and consumed by that connection into a multi-stream. In this way you can service a connection between nodes with a single stream of bytes.

The is_server boolean should be true at one end of the connection and false at the other. Usually it will be true for the node receiving a connection and false for the node initiating one.

Traffic will be written to, and read from, the given reader and writer.

The quality will be used to make routing decisions when establishing streams across multiple nodes.