]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Change liveness value to be a function of the timeout.
authorMike Perry <mikeperry-git@fscked.org>
Thu, 17 Sep 2009 00:14:01 +0000 (17:14 -0700)
committerMike Perry <mikeperry-git@fscked.org>
Thu, 17 Sep 2009 00:20:34 +0000 (17:20 -0700)
And also the number of recent circuits used to decide
when the network changes.

src/or/circuitbuild.c
src/or/or.h

index a87ad2e290796fab7a7598286b035836a4d6903a..1cb1fd2144c983615cf3f389c2d6e5e8c6b2b842 100644 (file)
@@ -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;
index fb4ab8452f92286ccfef95cea1a6703d274c79ef..98fa841065f9f394b958f3c4307417ff649ba73c 100644 (file)
@@ -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