[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] [tor/master] Change liveness value to be a function of the timeout.
Author: Mike Perry <mikeperry-git@xxxxxxxxxx>
Date: Wed, 16 Sep 2009 17:14:01 -0700
Subject: Change liveness value to be a function of the timeout.
Commit: e2c2fa7a1f763b1815adc13bdea46d4dbdba78c1
And also the number of recent circuits used to decide
when the network changes.
---
src/or/circuitbuild.c | 5 +++--
src/or/or.h | 4 ++--
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index a87ad2e..1cb1fd2 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -628,13 +628,14 @@ circuit_build_times_network_is_live(circuit_build_times_t *cbt)
/**
* Returns true if the network showed some sign of liveness
- * in the past NETWORK_LIVE_INTERVAL.
+ * in the past NETWORK_LIVE_MULTIPLIER*cbt->timeout seconds.
*/
int
circuit_build_times_is_network_live(circuit_build_times_t *cbt)
{
time_t now = approx_time();
- if (now - cbt->network_last_live > NETWORK_LIVE_INTERVAL) {
+ if (now - cbt->network_last_live >
+ (cbt->timeout*NETWORK_LIVE_MULTIPLIER)) {
log_info(LD_CIRC, "Network is no longer live. Dead for %ld seconds.",
now - cbt->network_last_live);
return 0;
diff --git a/src/or/or.h b/src/or/or.h
index fb4ab84..98fa841 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -2885,8 +2885,8 @@ void entry_guards_free_all(void);
typedef uint32_t build_time_t;
#define BUILD_TIME_MAX ((build_time_t)(INT32_MAX))
-/** Have we received a cell in the last 90 seconds? */
-#define NETWORK_LIVE_INTERVAL 90
+/** Have we received a cell in the last N seconds? */
+#define NETWORK_LIVE_MULTIPLIER (RECENT_CIRCUITS/2.5)
/** Lowest allowable value for CircuitBuildTimeout */
#define BUILD_TIMEOUT_MIN_VALUE 3
--
1.5.6.5