diff options
author | Nick Mathewson <nickm@torproject.org> | 2018-06-02 10:36:44 -0700 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2018-06-02 10:36:44 -0700 |
commit | f15f90e2cac50154c761da94eb9fd642890f2777 (patch) | |
tree | 547fab583af1dcd89813d47ffc326792f80f1e10 /src | |
parent | fa1890e97f19a444f8103c1207d7d18c02887b1f (diff) | |
parent | fe5764012a05e5d9382e1a59d015ff6ca0bd804b (diff) | |
download | tor-f15f90e2cac50154c761da94eb9fd642890f2777.tar.gz tor-f15f90e2cac50154c761da94eb9fd642890f2777.zip |
Merge branch 'bug26121-033-squashed' into maint-0.3.3
Diffstat (limited to 'src')
-rw-r--r-- | src/or/circuitstats.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/or/circuitstats.c b/src/or/circuitstats.c index f87bbd822b..f06c2e5e38 100644 --- a/src/or/circuitstats.c +++ b/src/or/circuitstats.c @@ -1908,13 +1908,20 @@ cbt_control_event_buildtimeout_set(const circuit_build_times_t *cbt, /* The timeout rate is the ratio of the timeout count over * the total number of circuits attempted. The total number of - * circuits is (timeouts+succeeded+closed), since a circuit can - * either timeout, close, or succeed. We cast the denominator + * circuits is (timeouts+succeeded), since every circuit + * either succeeds, or times out. "Closed" circuits are + * MEASURE_TIMEOUT circuits whose measurement period expired. + * All MEASURE_TIMEOUT circuits are counted in the timeouts stat + * before transitioning to MEASURE_TIMEOUT (in + * circuit_build_times_mark_circ_as_measurement_only()). + * MEASURE_TIMEOUT circuits that succeed are *not* counted as + * "succeeded". See circuit_build_times_handle_completed_hop(). + * + * We cast the denominator * to promote it to double before the addition, to avoid int32 * overflow. */ const double total_circuits = - ((double)cbt->num_circ_timeouts) + cbt->num_circ_succeeded - + cbt->num_circ_closed; + ((double)cbt->num_circ_timeouts) + cbt->num_circ_succeeded; if (total_circuits >= 1.0) { timeout_rate = cbt->num_circ_timeouts / total_circuits; close_rate = cbt->num_circ_closed / total_circuits; |