aboutsummaryrefslogtreecommitdiff
path: root/src/or/circuituse.c
diff options
context:
space:
mode:
authorMike Perry <mikeperry-git@fscked.org>2010-09-29 11:49:31 -0700
committerMike Perry <mikeperry-git@fscked.org>2010-09-29 11:49:31 -0700
commit9a77743b7b2e657cb8d9fd413d53cb9e3b8e00ca (patch)
tree270ff5c6d5c9022ca0c756b442ef3819e5d1e531 /src/or/circuituse.c
parent4caf39f1c8db6acc25f84df024073d43c04c8645 (diff)
downloadtor-9a77743b7b2e657cb8d9fd413d53cb9e3b8e00ca.tar
tor-9a77743b7b2e657cb8d9fd413d53cb9e3b8e00ca.tar.gz
Fix non-live condition checks.
Rechecking the timeout condition was foolish, because it is checked on the same codepath. It was also wrong, because we didn't round. Also, the liveness check itself should be <, and not <=, because we only have 1 second resolution.
Diffstat (limited to 'src/or/circuituse.c')
-rw-r--r--src/or/circuituse.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/or/circuituse.c b/src/or/circuituse.c
index ce03500f3..6ecb92523 100644
--- a/src/or/circuituse.c
+++ b/src/or/circuituse.c
@@ -34,8 +34,6 @@ extern circuit_t *global_circuitlist; /* from circuitlist.c */
static void circuit_expire_old_circuits_clientside(time_t now);
static void circuit_increment_failure_count(void);
-long int lround(double x);
-
/** Return 1 if <b>circ</b> could be returned by circuit_get_best().
* Else return 0.
*/
@@ -282,11 +280,11 @@ circuit_expire_building(time_t now)
circuit_t *victim, *next_circ = global_circuitlist;
/* circ_times.timeout is BUILD_TIMEOUT_INITIAL_VALUE if we haven't
* decided on a customized one yet */
- time_t general_cutoff = now - lround(circ_times.timeout_ms/1000);
- time_t begindir_cutoff = now - lround(circ_times.timeout_ms/2000);
- time_t fourhop_cutoff = now - lround(4*circ_times.timeout_ms/3000);
- time_t cannibalize_cutoff = now - lround(circ_times.timeout_ms/2000);
- time_t close_cutoff = now - lround(circ_times.close_ms/1000);
+ time_t general_cutoff = now - tor_lround(circ_times.timeout_ms/1000);
+ time_t begindir_cutoff = now - tor_lround(circ_times.timeout_ms/2000);
+ time_t fourhop_cutoff = now - tor_lround(4*circ_times.timeout_ms/3000);
+ time_t cannibalize_cutoff = now - tor_lround(circ_times.timeout_ms/2000);
+ time_t close_cutoff = now - tor_lround(circ_times.close_ms/1000);
time_t introcirc_cutoff = begindir_cutoff;
cpath_build_state_t *build_state;