diff --git a/src/entrypoint.rs b/src/entrypoint.rs index 73ebd7e..b793c06 100644 --- a/src/entrypoint.rs +++ b/src/entrypoint.rs @@ -1145,15 +1145,15 @@ async fn handle_https_connection( .increment(1); match sandhole.tcp_connection_timeout { Some(duration) => { - let _ = timeout(duration, async { - let _ = copy_bidirectional_with_sizes( + let _ = timeout( + duration, + copy_bidirectional_with_sizes( &mut stream, &mut channel, sandhole.buffer_size, sandhole.buffer_size, - ) - .await; - }) + ), + ) .await; } None => { diff --git a/src/http/http11.rs b/src/http/http11.rs index 4facedf..d87a9cd 100644 --- a/src/http/http11.rs +++ b/src/http/http11.rs @@ -143,15 +143,15 @@ where match websocket_timeout { // If there is a Websocket timeout, copy until the deadline is reached. Some(duration) => { - let _ = timeout(duration, async { + let _ = timeout( + duration, copy_bidirectional_with_sizes( &mut upgraded_response, &mut upgraded_request, buffer_size, buffer_size, - ) - .await - }) + ), + ) .await; } // If there isn't a Websocket timeout, copy data between both sides unconditionally. diff --git a/src/ssh/forwarding.rs b/src/ssh/forwarding.rs index dc1cad3..31cdc30 100644 --- a/src/ssh/forwarding.rs +++ b/src/ssh/forwarding.rs @@ -456,15 +456,15 @@ impl ForwardingHandlerStrategy for SshForwardingHandler { let mut stream = channel.into_stream(); match tcp_connection_timeout { Some(duration) => { - let _ = timeout(duration, async { + let _ = timeout( + duration, copy_bidirectional_with_sizes( &mut stream, &mut io, buffer_size, buffer_size, - ) - .await - }) + ), + ) .await; } None => { @@ -489,15 +489,15 @@ impl ForwardingHandlerStrategy for SshForwardingHandler { let mut stream = channel.into_stream(); match tcp_connection_timeout { Some(duration) => { - let _ = timeout(duration, async { + let _ = timeout( + duration, copy_bidirectional_with_sizes( &mut stream, &mut io, buffer_size, buffer_size, - ) - .await - }) + ), + ) .await; } None => { @@ -1013,15 +1013,15 @@ impl ForwardingHandlerStrategy for HttpForwardingHandler { tokio::spawn(async move { match tcp_connection_timeout { Some(duration) => { - let _ = timeout(duration, async { - let _ = copy_bidirectional_with_sizes( + let _ = timeout( + duration, + copy_bidirectional_with_sizes( &mut stream, &mut channel, buffer_size, buffer_size, - ) - .await; - }) + ), + ) .await; } None => { @@ -1327,15 +1327,15 @@ impl ForwardingHandlerStrategy for AliasForwardingHandler { let mut stream = channel.into_stream(); match tcp_connection_timeout { Some(duration) => { - let _ = timeout(duration, async { + let _ = timeout( + duration, copy_bidirectional_with_sizes( &mut stream, &mut io, buffer_size, buffer_size, - ) - .await - }) + ), + ) .await; } None => { @@ -1398,15 +1398,15 @@ impl ForwardingHandlerStrategy for AliasForwardingHandler { let mut stream = channel.into_stream(); match tcp_connection_timeout { Some(duration) => { - let _ = timeout(duration, async { + let _ = timeout( + duration, copy_bidirectional_with_sizes( &mut stream, &mut io, buffer_size, buffer_size, - ) - .await - }) + ), + ) .await; } None => { @@ -1431,15 +1431,15 @@ impl ForwardingHandlerStrategy for AliasForwardingHandler { let mut stream = channel.into_stream(); match tcp_connection_timeout { Some(duration) => { - let _ = timeout(duration, async { + let _ = timeout( + duration, copy_bidirectional_with_sizes( &mut stream, &mut io, buffer_size, buffer_size, - ) - .await - }) + ), + ) .await; } None => { @@ -1804,15 +1804,15 @@ impl ForwardingHandlerStrategy for TcpForwardingHandler { let mut stream = channel.into_stream(); match tcp_connection_timeout { Some(duration) => { - let _ = timeout(duration, async { + let _ = timeout( + duration, copy_bidirectional_with_sizes( &mut stream, &mut io, buffer_size, buffer_size, - ) - .await - }) + ), + ) .await; } None => { @@ -1837,15 +1837,15 @@ impl ForwardingHandlerStrategy for TcpForwardingHandler { let mut stream = channel.into_stream(); match tcp_connection_timeout { Some(duration) => { - let _ = timeout(duration, async { + let _ = timeout( + duration, copy_bidirectional_with_sizes( &mut stream, &mut io, buffer_size, buffer_size, - ) - .await - }) + ), + ) .await; } None => { diff --git a/src/ssh/mod.rs b/src/ssh/mod.rs index 69b207c..913bc2c 100644 --- a/src/ssh/mod.rs +++ b/src/ssh/mod.rs @@ -210,15 +210,14 @@ impl Handler for ServerHandler { { if let Some(ref api_login) = self.server.api_login { // Send an auth request with a timeout. - match timeout(self.server.authentication_request_timeout, async { - api_login - .authenticate(&AuthenticationRequest { - user, - password, - remote_address: &self.peer, - }) - .await - }) + match timeout( + self.server.authentication_request_timeout, + api_login.authenticate(&AuthenticationRequest { + user, + password, + remote_address: &self.peer, + }), + ) .await { Ok(Ok(is_authenticated)) => { diff --git a/src/tcp.rs b/src/tcp.rs index cc73c70..787414b 100644 --- a/src/tcp.rs +++ b/src/tcp.rs @@ -98,15 +98,15 @@ impl TcpPortHandler for Arc { match clone.tcp_connection_timeout { Some(duration) => { tokio::spawn(async move { - let _ = timeout(duration, async { + let _ = timeout( + duration, copy_bidirectional_with_sizes( &mut stream, &mut channel, buffer_size, buffer_size, - ) - .await - }) + ), + ) .await; }); }