Skip to content

Commit

Permalink
fix(core): calculate target hop from maximum hop per round (#1226)
Browse files Browse the repository at this point in the history
  • Loading branch information
fujiapple852 committed Jul 20, 2024
1 parent c5b9de0 commit fadf9f1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions crates/trippy-core/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -407,16 +407,16 @@ impl FlowState {
}

const fn is_target(&self, hop: &Hop) -> bool {
self.highest_ttl == hop.ttl
self.highest_ttl_for_round == hop.ttl
}

const fn is_in_round(&self, hop: &Hop) -> bool {
hop.ttl <= self.highest_ttl_for_round
}

fn target_hop(&self) -> &Hop {
if self.highest_ttl > 0 {
&self.hops[usize::from(self.highest_ttl) - 1]
if self.highest_ttl_for_round > 0 {
&self.hops[usize::from(self.highest_ttl_for_round) - 1]
} else {
&self.hops[0]
}
Expand Down

0 comments on commit fadf9f1

Please sign in to comment.