Skip to content

Commit

Permalink
fix(backend): filter hosts used for flows to complete and pending and…
Browse files Browse the repository at this point in the history
… limit to max ttl
  • Loading branch information
fujiapple852 committed Nov 12, 2023
1 parent f7e6f67 commit 79ede90
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/backend/trace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,16 @@ impl Trace {

/// Update the tracing state from a `TracerRound`.
pub(super) fn update_from_round(&mut self, round: &TracerRound<'_>) {
let flow = Flow::from_hops(round.probes.iter().map(|p| p.host));
let flow = Flow::from_hops(
round
.probes
.iter()
.filter(|probe| {
matches!(probe.status, ProbeStatus::Complete | ProbeStatus::Awaited)
})
.take(usize::from(round.largest_ttl.0))
.map(|p| p.host),
);
let flow_id = self.registry.register(flow);
self.update_trace_flow(Self::default_flow_id(), round);
self.update_trace_flow(flow_id, round);
Expand Down

0 comments on commit 79ede90

Please sign in to comment.