From 031e3df57e113c7404bd3da727e9e76b3eac2355 Mon Sep 17 00:00:00 2001 From: Joakim Hulthe Date: Fri, 13 Dec 2024 15:42:59 +0100 Subject: [PATCH] fixup: broken timeout --- leak-checker/src/traceroute.rs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/leak-checker/src/traceroute.rs b/leak-checker/src/traceroute.rs index a4040f2ad9c1..c7b42048e839 100644 --- a/leak-checker/src/traceroute.rs +++ b/leak-checker/src/traceroute.rs @@ -139,14 +139,21 @@ pub async fn try_run_leak_test(opt: &TracerouteOpt) -> eyre::Result send_udp_probes(opt, &mut udp_socket).await?; } - // Never return - pending::>().await + eyre::Ok(()) }; // error if sending the probes takes longer than SEND_TIMEOUT - let send_probes = timeout(SEND_TIMEOUT, send_probes) - .map_err(|_timeout| eyre!("Timed out while trying to send probe packet")) - .and_then(ready); + //let send_probes = timeout(SEND_TIMEOUT, send_probes) + // .map_err(|_timeout| eyre!("Timed out while trying to send probe packet")) + // .and_then(ready) // flatten the result + // .and_then(|_| pending::>()); + + let send_probes = async { + timeout(SEND_TIMEOUT, send_probes) + .await + .map_err(|_timeout| eyre!("Timed out while trying to send probe packet"))??; + Ok(pending::().await) + }; let recv_probe_responses = icmp_socket.recv_ttl_responses(opt);