]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Set default minimum bandwidth for exit flag to zero for TestingTorNetwork
authorAndrea Shepard <andrea@torproject.org>
Wed, 20 Mar 2013 18:16:41 +0000 (11:16 -0700)
committerAndrea Shepard <andrea@torproject.org>
Wed, 20 Mar 2013 18:16:41 +0000 (11:16 -0700)
src/or/config.c
src/or/dirserv.c
src/or/or.h

index 9e2230e769319c6085cb7761d26ab943d1b67bf0..a238a1ae70e66a05c2a14aa3b439d4ce92886556 100644 (file)
@@ -341,6 +341,7 @@ static config_var_t option_vars_[] = {
   V(PerConnBWRate,               MEMUNIT,  "0"),
   V(PidFile,                     STRING,   NULL),
   V(TestingTorNetwork,           BOOL,     "0"),
+  V(TestingMinExitFlagThreshold, MEMUNIT,  "0"),
   V(TestingMinFastFlagThreshold, MEMUNIT,  "0"),
   V(OptimisticData,              AUTOBOOL, "auto"),
   V(PortForwarding,              BOOL,     "0"),
index 81f328a647b65ab7314cba995566af85b4be7e7e..e837e4bed5a769e667ddc81fa9ebda06197b2ca6 100644 (file)
@@ -1894,11 +1894,17 @@ router_counts_toward_thresholds(const node_t *node, time_t now,
   /* Have measured bw? */
   int have_mbw =
     dirserv_has_measured_bw(node->ri->cache_info.identity_digest);
+  uint64_t min_bw = ABSOLUTE_MIN_BW_VALUE_TO_CONSIDER;
+  const or_options_t *options = get_options();
+
+  if (options->TestingTorNetwork) {
+    min_bw = (int64_t)options->TestingMinExitFlagThreshold;
+  }
 
   return node->ri && router_is_active(node->ri, node, now) &&
     !digestmap_get(omit_as_sybil, node->ri->cache_info.identity_digest) &&
-    (dirserv_get_credible_bandwidth(node->ri) >=
-       ABSOLUTE_MIN_BW_VALUE_TO_CONSIDER) && (have_mbw || !require_mbw);
+    (dirserv_get_credible_bandwidth(node->ri) >= min_bw) &&
+    (have_mbw || !require_mbw);
 }
 
 /** Look through the routerlist, the Mean Time Between Failure history, and
index 2b0102de32c8390d8369df83392143911f9f92da..4e19140b4bb76c5e34bed96dc81b9371e890120b 100644 (file)
@@ -3910,6 +3910,9 @@ typedef struct {
    * of certain configuration options. */
   int TestingTorNetwork;
 
+  /** Minimum value for the Exit flag threshold on testing networks. */
+  uint64_t TestingMinExitFlagThreshold;
+
   /** Minimum value for the Fast flag threshold on testing networks. */
   uint64_t TestingMinFastFlagThreshold;