Skip to main content

spawn_channel_relay

Function spawn_channel_relay 

Source
pub fn spawn_channel_relay<F, G>(
    channel_id: u32,
    read_half: OwnedReadHalf,
    write_half: OwnedWriteHalf,
    on_data: F,
    on_close: G,
) -> UnboundedSender<Bytes>
where F: Fn(u32, Bytes) -> bool + Send + 'static, G: Fn(u32) + Send + 'static,
Expand description

Spawn bidirectional relay tasks for a Unix stream channel.

Reader task reads from the stream and calls on_data/on_close. Writer task drains the returned sender and writes to the stream.