diff --git a/crates/ptth_relay/src/lib.rs b/crates/ptth_relay/src/lib.rs index 8f49341..136e004 100644 --- a/crates/ptth_relay/src/lib.rs +++ b/crates/ptth_relay/src/lib.rs @@ -144,15 +144,14 @@ async fn handle_http_request ( state.park_client (server_name, req, &req_id).await; - let timeout = tokio::time::sleep (std::time::Duration::from_secs (30)); - - let received = tokio::select! { - val = rx => val, - () = timeout => { + let received = match tokio::time::timeout (Duration::from_secs (30), rx).await + { + Ok (x) => x, + Err (_) => { debug! ("Timed out request {}", req_id); - return error_reply (StatusCode::GATEWAY_TIMEOUT, "Remote server never responded") - }, - }; + return error_reply (StatusCode::GATEWAY_TIMEOUT, "Remote server never responded"); + } + }; // UKAUFFY4 (Receive half) match received {