[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] Set default minimum bandwidth for exit flag to zero for TestingTorNetwork



commit 5c5198e713365fecf44741ae6f287c2ebdef18f6
Author: Andrea Shepard <andrea@xxxxxxxxxxxxxx>
Date:   Wed Mar 20 11:16:41 2013 -0700

    Set default minimum bandwidth for exit flag to zero for TestingTorNetwork
---
 src/or/config.c  |    1 +
 src/or/dirserv.c |   10 ++++++++--
 src/or/or.h      |    3 +++
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/or/config.c b/src/or/config.c
index 9e2230e..a238a1a 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -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"),
diff --git a/src/or/dirserv.c b/src/or/dirserv.c
index 81f328a..e837e4b 100644
--- a/src/or/dirserv.c
+++ b/src/or/dirserv.c
@@ -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
diff --git a/src/or/or.h b/src/or/or.h
index 2b0102d..4e19140 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -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;
 



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits