diff options
author | Mike Perry <mikeperry-git@fscked.org> | 2009-09-18 01:48:07 -0700 |
---|---|---|
committer | Mike Perry <mikeperry-git@fscked.org> | 2009-09-20 14:43:45 -0700 |
commit | 6700e528be5ee688439730f7e8f13b3ce9b64e09 (patch) | |
tree | c8c361570840d8f864960ec5356b46ea78dc52bd /src/or/circuituse.c | |
parent | 2218fd22c580407230995518d9f52b3cd888774f (diff) | |
download | tor-6700e528be5ee688439730f7e8f13b3ce9b64e09.tar.gz tor-6700e528be5ee688439730f7e8f13b3ce9b64e09.zip |
Fix some precision-related asserts in unit tests.
Mostly by storing the timeout as milliseconds and not seconds
internally.
Diffstat (limited to 'src/or/circuituse.c')
-rw-r--r-- | src/or/circuituse.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/or/circuituse.c b/src/or/circuituse.c index 856705ead4..f95f25407f 100644 --- a/src/or/circuituse.c +++ b/src/or/circuituse.c @@ -20,6 +20,8 @@ extern circuit_t *global_circuitlist; /* from circuitlist.c */ static void circuit_expire_old_circuits(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. */ @@ -266,8 +268,8 @@ circuit_expire_building(time_t now) circuit_t *victim, *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 - circ_times.timeout; - time_t begindir_cutoff = now - circ_times.timeout/2; + time_t general_cutoff = now - lround(circ_times.timeout_ms/1000); + time_t begindir_cutoff = now - lround(circ_times.timeout_ms/2000); time_t introcirc_cutoff = begindir_cutoff; cpath_build_state_t *build_state; |