Skip to content

Commit

Permalink
fixup: broken timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
hulthe committed Dec 13, 2024
1 parent e036050 commit 031e3df
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions leak-checker/src/traceroute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,21 @@ pub async fn try_run_leak_test(opt: &TracerouteOpt) -> eyre::Result<LeakStatus>
send_udp_probes(opt, &mut udp_socket).await?;
}

// Never return
pending::<eyre::Result<Infallible>>().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::<Result<Infallible, _>>());

let send_probes = async {
timeout(SEND_TIMEOUT, send_probes)
.await
.map_err(|_timeout| eyre!("Timed out while trying to send probe packet"))??;
Ok(pending::<Infallible>().await)
};

let recv_probe_responses = icmp_socket.recv_ttl_responses(opt);

Expand Down

0 comments on commit 031e3df

Please sign in to comment.