summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2013-02-04 10:47:08 -0500
committerNick Mathewson <nickm@torproject.org>2013-02-04 10:47:08 -0500
commit61995d3e2cd7631df1fcb9fbdf9333dee24566b4 (patch)
tree58abe3870473458ac4d9d4b262ec89d9dcccd0c0
parent317d16de04ef9f2fa827b3bea2d858069a721e24 (diff)
downloadtor-61995d3e2cd7631df1fcb9fbdf9333dee24566b4.tar.gz
tor-61995d3e2cd7631df1fcb9fbdf9333dee24566b4.zip
Ignore tiny bandwidths entirely when computing thresholds
Another bug 8145 fix.
-rw-r--r--changes/bug8146_etc3
-rw-r--r--src/or/dirserv.c8
2 files changed, 10 insertions, 1 deletions
diff --git a/changes/bug8146_etc b/changes/bug8146_etc
index 3775aa5059..274e2abe48 100644
--- a/changes/bug8146_etc
+++ b/changes/bug8146_etc
@@ -5,3 +5,6 @@
- When computing thresholds for flags, never let the threshold for
the Fast flag to 4096 bytes. Fixes bug 8145.
+ - Do not consider nodes with extremely low bandwidths when deciding
+ thresholds for various directory flags. Another fix for 8145.
+
diff --git a/src/or/dirserv.c b/src/or/dirserv.c
index f3cb2de918..0c3e72f3a3 100644
--- a/src/or/dirserv.c
+++ b/src/or/dirserv.c
@@ -1884,6 +1884,10 @@ dirserv_thinks_router_is_hs_dir(const routerinfo_t *router,
node->is_running);
}
+/** Don't consider routers with less bandwidth than this when computing
+ * thresholds. */
+#define ABSOLUTE_MIN_BW_VALUE_TO_CONSIDER 4096
+
/** Helper for dirserv_compute_performance_thresholds(): Decide whether to
* include a router in our calculations, and return true iff we should. */
static int
@@ -1891,7 +1895,9 @@ router_counts_toward_thresholds(const node_t *node, time_t now,
const digestmap_t *omit_as_sybil)
{
return node->ri && router_is_active(node->ri, node, now) &&
- !digestmap_get(omit_as_sybil, node->ri->cache_info.identity_digest);
+ !digestmap_get(omit_as_sybil, node->ri->cache_info.identity_digest) &&
+ (router_get_advertised_bandwidth(node->ri) >=
+ ABSOLUTE_MIN_BW_VALUE_TO_CONSIDER);
}
/** Look through the routerlist, the Mean Time Between Failure history, and