aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2009-12-15 15:46:25 -0500
committerNick Mathewson <nickm@torproject.org>2009-12-15 17:11:27 -0500
commit3b896195cb1cd3bded9eb503b33c10bf0eeeaf68 (patch)
tree0252767370caf59905d1bb9b0cb5c380c53999f9
parent3802af8806b074d4f53885c05b9952d2cd26a07f (diff)
downloadtor-3b896195cb1cd3bded9eb503b33c10bf0eeeaf68.tar.gz
tor-3b896195cb1cd3bded9eb503b33c10bf0eeeaf68.zip
Stop using lround in or.h, and check for bad values of RECENT_CIRCUITS
-rw-r--r--src/or/or.h12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/or/or.h b/src/or/or.h
index a51fdd39bf..40bf74e260 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -3002,7 +3002,7 @@ typedef uint32_t build_time_t;
* at which point we switch back to computing the timeout from
* our saved history.
*/
-#define NETWORK_NONLIVE_TIMEOUT_COUNT (tor_lround(RECENT_CIRCUITS*0.15))
+#define NETWORK_NONLIVE_TIMEOUT_COUNT (RECENT_CIRCUITS*3/20)
/**
* This tells us when to toss out the last streak of N timeouts.
@@ -3010,8 +3010,7 @@ typedef uint32_t build_time_t;
* If instead we start getting cells, we switch back to computing the timeout
* from our saved history.
*/
-#define NETWORK_NONLIVE_DISCARD_COUNT \
- (tor_lround(NETWORK_NONLIVE_TIMEOUT_COUNT*2))
+#define NETWORK_NONLIVE_DISCARD_COUNT (NETWORK_NONLIVE_TIMEOUT_COUNT*2)
/**
* Maximum count of timeouts that finish the first hop in the past
@@ -3020,7 +3019,12 @@ typedef uint32_t build_time_t;
* This tells us to abandon timeout history and set
* the timeout back to BUILD_TIMEOUT_INITIAL_VALUE.
*/
-#define MAX_RECENT_TIMEOUT_COUNT (tor_lround(RECENT_CIRCUITS*0.8))
+#define MAX_RECENT_TIMEOUT_COUNT (RECENT_CIRCUITS*4/5)
+
+#if MAX_RECENT_TIMEOUT_COUNT < 1 || NETWORK_NONLIVE_DISCARD_COUNT < 1 || \
+ NETWORK_NONLIVE_TIMEOUT_COUNT < 1
+#error "RECENT_CIRCUITS is set too low."
+#endif
/** Information about the state of our local network connection */
typedef struct {