Not including gateway non-delay when calculating total packet delay (#507)
This commit is contained in:
committed by
GitHub
parent
2314baf0d3
commit
3a261d22f5
@@ -72,7 +72,8 @@ impl SURBAck {
|
||||
.build_packet(surb_ack_payload, &route, &destination, &delays)
|
||||
.unwrap();
|
||||
|
||||
let expected_total_delay = delays.iter().sum();
|
||||
// in our case, the last hop is a gateway that does NOT do any delays
|
||||
let expected_total_delay = delays.iter().take(delays.len() - 1).sum();
|
||||
let first_hop_address =
|
||||
NymNodeRoutingAddress::try_from(route.first().unwrap().address).unwrap();
|
||||
|
||||
|
||||
@@ -331,7 +331,8 @@ where
|
||||
Ok(PreparedFragment {
|
||||
// the round-trip delay is the sum of delays of all hops on the forward route as
|
||||
// well as the total delay of the ack packet.
|
||||
total_delay: delays.iter().sum::<Delay>() + ack_delay,
|
||||
// note that the last hop of the packet is a gateway that does not do any delays
|
||||
total_delay: delays.iter().take(delays.len() - 1).sum::<Delay>() + ack_delay,
|
||||
mix_packet: MixPacket::new(first_hop_address, sphinx_packet, self.mode),
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user