summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Perry <mikeperry-git@fscked.org>2010-02-14 14:45:45 -0800
committerMike Perry <mikeperry-git@fscked.org>2010-02-22 16:52:11 -0800
commit245be159afa206676b05b9b5d5a11aa1f6b25bd7 (patch)
tree13bb46fe9314bbf39ff7f4e66e0dc47f3a8b66c8
parent5d4f5ef07d8e28018e1520d0cc413a75092a9304 (diff)
downloadtor-245be159afa206676b05b9b5d5a11aa1f6b25bd7.tar.gz
tor-245be159afa206676b05b9b5d5a11aa1f6b25bd7.zip
Always weight routers by bandwidth.
Also always predict that we need a high capacity circuit or internal circuit.
-rw-r--r--src/or/circuitbuild.c2
-rw-r--r--src/or/rephist.c4
-rw-r--r--src/or/routerlist.c6
3 files changed, 6 insertions, 6 deletions
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index 08ee58416b..eef610d2b6 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -2133,6 +2133,8 @@ circuit_all_predicted_ports_handled(time_t now, int *need_uptime,
smartlist_t *LongLivedServices = get_options()->LongLivedPorts;
tor_assert(need_uptime);
tor_assert(need_capacity);
+ // Always predict need_capacity
+ *need_capacity = 1;
enough = (smartlist_len(sl) == 0);
for (i = 0; i < smartlist_len(sl); ++i) {
port = smartlist_get(sl, i);
diff --git a/src/or/rephist.c b/src/or/rephist.c
index e606db3b7b..8729a12088 100644
--- a/src/or/rephist.c
+++ b/src/or/rephist.c
@@ -1909,8 +1909,8 @@ rep_hist_get_predicted_internal(time_t now, int *need_uptime,
return 0; /* too long ago */
if (predicted_internal_uptime_time + PREDICTED_CIRCS_RELEVANCE_TIME >= now)
*need_uptime = 1;
- if (predicted_internal_capacity_time + PREDICTED_CIRCS_RELEVANCE_TIME >= now)
- *need_capacity = 1;
+ // Always predict that we need capacity.
+ *need_capacity = 1;
return 1;
}
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index 6cd8b6d83b..80229f2141 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -2070,10 +2070,8 @@ router_choose_random_node(smartlist_t *excludedsmartlist,
if (excludedset)
routerset_subtract_routers(sl,excludedset);
- if (need_capacity || need_guard)
- choice = routerlist_sl_choose_by_bandwidth(sl, rule);
- else
- choice = smartlist_choose(sl);
+ // Always weight by bandwidth
+ choice = routerlist_sl_choose_by_bandwidth(sl, rule);
smartlist_free(sl);
if (!choice && (need_uptime || need_capacity || need_guard)) {