Function transfer_session

Source
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.:

  1. Initiates graceful shutdown of stream
  2. Once done, initiates a graceful shutdown of session
  3. The function terminates, returning the number of bytes transferred in both directions.