Use same defaults for abandon and close times in timeout code.

On torspec!40, Mike says:

    I don't think there is a practical difference here. As per
    Section 2.4.5, if 60 seconds is not enough and causes the
    liveness test to fail due to too many timeouts, we will double
    the initial timeout.

This makes our behavior the same as C tor.
This commit is contained in:
Nick Mathewson 2021-09-07 14:53:50 -04:00
parent 5d7b08993e
commit 74fa18458e
1 changed files with 4 additions and 6 deletions

View File

@ -387,8 +387,7 @@ impl Default for Params {
significant_hop: 2,
timeout_quantile: 0.80,
abandon_quantile: 0.99,
// TODO-SPEC: Document this "abandon at timeout x 1.5" rule.
default_thresholds: (Duration::from_secs(60), Duration::from_secs(90)),
default_thresholds: (Duration::from_secs(60), Duration::from_secs(60)),
n_modes_for_xm: 10,
success_history_len: SUCCESS_HISTORY_DEFAULT_LEN,
reset_after_timeouts: 18,
@ -414,8 +413,7 @@ impl From<&tor_netdir::params::NetParameters> for Params {
significant_hop: 2,
timeout_quantile: p.cbt_timeout_quantile.as_fraction(),
abandon_quantile: p.cbt_abandon_quantile.as_fraction(),
// TODO-SPEC: the timeout*1.5 default here is unspecified.
default_thresholds: (timeout, (timeout * 3) / 2),
default_thresholds: (timeout, timeout),
n_modes_for_xm: p.cbt_num_xm_modes.get() as usize,
success_history_len: p.cbt_success_count.get() as usize,
reset_after_timeouts: p.cbt_max_timeouts.get() as usize,
@ -844,7 +842,7 @@ mod test {
assert_eq!(
est.timeouts(&b3()),
(Duration::from_secs(60), Duration::from_secs(90))
(Duration::from_secs(60), Duration::from_secs(60))
);
{
// Set the parameters up to mimic the situation in
@ -855,7 +853,7 @@ mod test {
}
assert_eq!(
est.timeouts(&b3()),
(Duration::from_secs(60), Duration::from_secs(90))
(Duration::from_secs(60), Duration::from_secs(60))
);
for msec in &[300, 500, 542, 305, 543, 307, 212, 203, 617, 413] {