[or-cvs] [tor/master 07/17] Always weight routers by bandwidth.

nickm at torproject.org nickm at torproject.org
Thu Feb 25 21:25:11 UTC 2010


Author: Mike Perry <mikeperry-git at fscked.org>
Date: Sun, 14 Feb 2010 14:45:45 -0800
Subject: Always weight routers by bandwidth.
Commit: 245be159afa206676b05b9b5d5a11aa1f6b25bd7

Also always predict that we need a high capacity circuit or internal
circuit.
---
 src/or/circuitbuild.c |    2 ++
 src/or/rephist.c      |    4 ++--
 src/or/routerlist.c   |    6 ++----
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index 08ee584..eef610d 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 e606db3..8729a12 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 6cd8b6d..80229f2 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)) {
-- 
1.6.5




More information about the tor-commits mailing list