Always weight routers by bandwidth.

Also always predict that we need a high capacity circuit or internal
circuit.
This commit is contained in:
Mike Perry 2010-02-14 14:45:45 -08:00
parent 5d4f5ef07d
commit 245be159af
3 changed files with 6 additions and 6 deletions

View File

@ -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);

View File

@ -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;
}

View File

@ -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)) {