summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2007-07-21 23:40:55 +0000
committerRoger Dingledine <arma@torproject.org>2007-07-21 23:40:55 +0000
commit56d3119581fc87cc096b9832de4aa1cd8ea1dc18 (patch)
treeefd27a07f435d5117584cda009026348f39c5848 /src
parenta916e07ea68c897d42704df49e423dcfc223ef98 (diff)
downloadtor-56d3119581fc87cc096b9832de4aa1cd8ea1dc18.tar.gz
tor-56d3119581fc87cc096b9832de4aa1cd8ea1dc18.zip
Directory authorities now call routers Fast if their bandwidth is
at least 100KB/s, and consider their bandwidth adequate to be a Guard if it is at least 250KB/s. This fix complements proposal 107. [Bugfix on 0.1.2.x] svn:r10897
Diffstat (limited to 'src')
-rw-r--r--src/or/dirserv.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/or/dirserv.c b/src/or/dirserv.c
index ae4c932189..546873bf3b 100644
--- a/src/or/dirserv.c
+++ b/src/or/dirserv.c
@@ -1437,6 +1437,12 @@ should_generate_v2_networkstatus(void)
* network using allegedly high-uptime nodes, displacing all the
* current guards. */
#define UPTIME_TO_GUARANTEE_STABLE (3600*24*30)
+/** Similarly, we protect sufficiently fast nodes from being pushed
+ * out of the set of Fast nodes. */
+#define BANDWIDTH_TO_GUARANTEE_FAST (100*1024)
+/** Similarly, every node with sufficient bandwidth can be considered
+ * for Guard status. */
+#define BANDWIDTH_TO_GUARANTEE_GUARD (250*1024)
/* Thresholds for server performance: set by
* dirserv_compute_performance_thresholds, and used by
@@ -1475,9 +1481,11 @@ dirserv_thinks_router_is_unreliable(time_t now,
(unsigned)uptime < UPTIME_TO_GUARANTEE_STABLE)
return 1;
}
- if (need_capacity &&
- router_get_advertised_bandwidth(router) < fast_bandwidth)
- return 1;
+ if (need_capacity) {
+ uint32_t bw = router_get_advertised_bandwidth(router);
+ if (bw < fast_bandwidth && bw < BANDWIDTH_TO_GUARANTEE_FAST)
+ return 1;
+ }
return 0;
}
@@ -1710,9 +1718,10 @@ set_routerstatus_from_routerinfo(routerstatus_t *rs,
rs->is_valid = ri->is_valid;
rs->is_possible_guard = rs->is_fast && rs->is_stable &&
(!rs->is_exit || exits_can_be_guards) &&
- router_get_advertised_bandwidth(ri) >=
- (exits_can_be_guards ? guard_bandwidth_including_exits :
- guard_bandwidth_excluding_exits);
+ (router_get_advertised_bandwidth(ri) >= BANDWIDTH_TO_GUARANTEE_GUARD ||
+ router_get_advertised_bandwidth(ri) >=
+ (exits_can_be_guards ? guard_bandwidth_including_exits :
+ guard_bandwidth_excluding_exits));
rs->is_bad_exit = listbadexits && ri->is_bad_exit;
/* 0.1.1.9-alpha is the first version to support fetch by descriptor
* hash. */