Function arti::socks::copy_interactive
source · [−]async fn copy_interactive<R, W>(reader: R, writer: W) -> IoResult<()> where
R: AsyncRead + Unpin,
W: AsyncWrite + Unpin,
Available on crate feature
experimental-api
only.Expand description
Copy all the data from reader
into writer
until we encounter an EOF or
an error.
Unlike as futures::io::copy(), this function is meant for use with interactive readers and writers, where the reader might pause for a while, but where we want to send data on the writer as soon as it is available.
This function assumes that the writer might need to be flushed for any buffered data to be sent. It tries to minimize the number of flushes, however, by only flushing the writer when the reader has no data.