Skip to main content

relay_bidirectional_with_timeout

Function relay_bidirectional_with_timeout 

Source
pub async fn relay_bidirectional_with_timeout(
    stream_a: TcpStream,
    stream_b: TcpStream,
    idle_timeout: Option<Duration>,
) -> Result<(), ProtocolError>
Expand description

Relay data bidirectionally, ending the session when both sides reach end-of-stream. Neither direction is cancelled when the other observes EOF — half-close is preserved so the still-open direction can drain any application bytes the peer already produced.