Function copy_duplex

Source
pub async fn copy_duplex<A, B>(
    a: &mut A,
    b: &mut B,
    a_to_b_buffer_size: usize,
    b_to_a_buffer_size: usize,
) -> Result<(u64, u64)>
where A: AsyncRead + AsyncWrite + Unpin + ?Sized, B: AsyncRead + AsyncWrite + Unpin + ?Sized,
Expand description

This is a proper re-implementation of Tokio’s copy_bidirectional_with_sizes, which does not leave the stream in half-open-state when one side closes read or write side. Instead, if either side encounters and empty read (EOF indication), the write-side is closed as well and vice versa.