summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2007-01-06 06:26:53 +0000
committerNick Mathewson <nickm@torproject.org>2007-01-06 06:26:53 +0000
commitaa7b72c97d803e982207376cd2a8f3e34f36ce52 (patch)
tree96fb5c58c52fdf089810ce13aeebd0e74cfa9631
parent336624ce8f96b092a2be603fcf658ab02a6392cf (diff)
downloadtor-aa7b72c97d803e982207376cd2a8f3e34f36ce52.tar.gz
tor-aa7b72c97d803e982207376cd2a8f3e34f36ce52.zip
r11863@Kushana: nickm | 2007-01-06 01:12:24 -0500
Fix computation of total_exit_bandwidth; this will cause exits not to get recommended as guards if the total exit bandwidth if they constitute less than a third of total available bandwidth. There may be problems here with flapping; lets see if they occur in practice. svn:r9281
-rw-r--r--ChangeLog4
-rw-r--r--src/or/dirserv.c20
2 files changed, 12 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index 02454b11da..7dea592d60 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -20,6 +20,10 @@ Changes in version 0.1.2.6-alpha - 2007-??-??
server status events so controllers can learn about Tor's progress in
deciding whether it's reachable from the outside.
+ o Minor features (directory):
+ - Authorities do not recommend exits as guards if this would shift
+ excess load to the exit nodes.
+
o Minor bugfixes:
- Restore a warning message if we accidentally resolve an address that
we weren't planning to resolve.
diff --git a/src/or/dirserv.c b/src/or/dirserv.c
index f2dc38f496..c7f0462a3e 100644
--- a/src/or/dirserv.c
+++ b/src/or/dirserv.c
@@ -1337,7 +1337,8 @@ _compare_uint32(const void **a, const void **b)
* servers to stable_uptime, and the relative bandwidth capacities to
* fast_bandwidth and guard_bandwidth. Set total_bandwidth to the total
* capacity of all running valid servers and total_exit_bandwidth to the
- * capacity of all running valid exits. */
+ * capacity of all running valid exits. Set the is_exit flag of each router
+ * appropriately. */
static void
dirserv_compute_performance_thresholds(routerlist_t *rl)
{
@@ -1354,20 +1355,14 @@ dirserv_compute_performance_thresholds(routerlist_t *rl)
if (ri->is_running && ri->is_valid) {
uint32_t *up = tor_malloc(sizeof(uint32_t));
uint32_t *bw = tor_malloc(sizeof(uint32_t));
+ ri->is_exit = exit_policy_is_general_exit(ri->exit_policy);
*up = (uint32_t) real_uptime(ri, now);
smartlist_add(uptimes, up);
*bw = router_get_advertised_bandwidth(ri);
total_bandwidth += *bw;
- total_exit_bandwidth += *bw;
- /* XXX012 The above line doesn't actually count exit bandwidth. */
- /* While we're at it, we might want to avoid BadExit nodes when
- * counting exit bandwidth. */
- /* Also, we might want to document the one-third behavior in
- * dir-spec.txt. */
-/* ChangeLog line when we reenable it:
- - Authorities do not recommend exits as guards if this would shift
- excess load to the exit nodes.
-*/
+ if (ri->is_exit && !ri->is_bad_exit)
+ total_exit_bandwidth += *bw;
+ /* XXXX012 Document the one-third behavior in dir-spec.txt. */
smartlist_add(bandwidths, bw);
}
});
@@ -1508,7 +1503,8 @@ generate_v2_networkstatus(void)
SMARTLIST_FOREACH(rl->routers, routerinfo_t *, ri, {
if (ri->cache_info.published_on >= cutoff) {
- int f_exit = exit_policy_is_general_exit(ri->exit_policy);
+ /* Already set by compute_performance_thresholds. */
+ int f_exit = ri->is_exit;
/* These versions dump connections with idle live circuits
sometimes. D'oh!*/
int unstable_version =