pub async fn transfer_session<S>(
session: &mut Session,
stream: &mut S,
max_buffer: usize,
abort_stream: Option<AbortRegistration>,
) -> Result<(usize, usize), Error>where
S: AsyncRead + AsyncWrite + Unpin,
Expand description
Convenience function to copy data in both directions between a Session
and arbitrary
async IO stream.
This function is only available with Tokio and will panic with other runtimes.
The abort_stream
will terminate the transfer from the stream
side, i.e.:
- Initiates graceful shutdown of
stream
- Once done, initiates a graceful shutdown of
session
- The function terminates, returning the number of bytes transferred in both directions.