|
@@ -1422,13 +1422,13 @@ router_counts_toward_thresholds(const node_t *node, time_t now,
|
|
|
*
|
|
|
* Also, set the is_exit flag of each router appropriately. */
|
|
|
static void
|
|
|
-dirserv_compute_performance_thresholds(const smartlist_t *routers,
|
|
|
- digestmap_t *omit_as_sybil)
|
|
|
+dirserv_compute_performance_thresholds(digestmap_t *omit_as_sybil)
|
|
|
{
|
|
|
int n_active, n_active_nonexit, n_familiar;
|
|
|
uint32_t *uptimes, *bandwidths_kb, *bandwidths_excluding_exits_kb;
|
|
|
long *tks;
|
|
|
double *mtbfs, *wfus;
|
|
|
+ smartlist_t *nodelist;
|
|
|
time_t now = time(NULL);
|
|
|
const or_options_t *options = get_options();
|
|
|
|
|
@@ -1446,27 +1446,28 @@ dirserv_compute_performance_thresholds(const smartlist_t *routers,
|
|
|
guard_tk = 0;
|
|
|
guard_wfu = 0;
|
|
|
|
|
|
+ nodelist_assert_ok();
|
|
|
+ nodelist = nodelist_get_list();
|
|
|
+
|
|
|
|
|
|
* sort them and use that to compute thresholds. */
|
|
|
n_active = n_active_nonexit = 0;
|
|
|
|
|
|
- uptimes = tor_calloc(smartlist_len(routers), sizeof(uint32_t));
|
|
|
+ uptimes = tor_calloc(smartlist_len(nodelist), sizeof(uint32_t));
|
|
|
|
|
|
- bandwidths_kb = tor_calloc(smartlist_len(routers), sizeof(uint32_t));
|
|
|
+ bandwidths_kb = tor_calloc(smartlist_len(nodelist), sizeof(uint32_t));
|
|
|
|
|
|
bandwidths_excluding_exits_kb =
|
|
|
- tor_calloc(smartlist_len(routers), sizeof(uint32_t));
|
|
|
+ tor_calloc(smartlist_len(nodelist), sizeof(uint32_t));
|
|
|
|
|
|
- mtbfs = tor_calloc(smartlist_len(routers), sizeof(double));
|
|
|
+ mtbfs = tor_calloc(smartlist_len(nodelist), sizeof(double));
|
|
|
|
|
|
- tks = tor_calloc(smartlist_len(routers), sizeof(long));
|
|
|
+ tks = tor_calloc(smartlist_len(nodelist), sizeof(long));
|
|
|
|
|
|
- wfus = tor_calloc(smartlist_len(routers), sizeof(double));
|
|
|
-
|
|
|
- nodelist_assert_ok();
|
|
|
+ wfus = tor_calloc(smartlist_len(nodelist), sizeof(double));
|
|
|
|
|
|
|
|
|
- SMARTLIST_FOREACH_BEGIN(nodelist_get_list(), node_t *, node) {
|
|
|
+ SMARTLIST_FOREACH_BEGIN(nodelist, node_t *, node) {
|
|
|
if (options->BridgeAuthoritativeDir &&
|
|
|
node->ri &&
|
|
|
node->ri->purpose != ROUTER_PURPOSE_BRIDGE)
|
|
@@ -1542,7 +1543,7 @@ dirserv_compute_performance_thresholds(const smartlist_t *routers,
|
|
|
* fill wfus with the wfu of every such "familiar" router. */
|
|
|
n_familiar = 0;
|
|
|
|
|
|
- SMARTLIST_FOREACH_BEGIN(nodelist_get_list(), node_t *, node) {
|
|
|
+ SMARTLIST_FOREACH_BEGIN(nodelist, node_t *, node) {
|
|
|
if (router_counts_toward_thresholds(node, now,
|
|
|
omit_as_sybil, require_mbw)) {
|
|
|
routerinfo_t *ri = node->ri;
|
|
@@ -1596,11 +1597,11 @@ dirserv_compute_performance_thresholds(const smartlist_t *routers,
|
|
|
* networkstatus_getinfo_by_purpose().
|
|
|
*/
|
|
|
void
|
|
|
-dirserv_compute_bridge_flag_thresholds(const smartlist_t *routers)
|
|
|
+dirserv_compute_bridge_flag_thresholds()
|
|
|
{
|
|
|
|
|
|
digestmap_t *omit_as_sybil = digestmap_new();
|
|
|
- dirserv_compute_performance_thresholds(routers, omit_as_sybil);
|
|
|
+ dirserv_compute_performance_thresholds(omit_as_sybil);
|
|
|
digestmap_free(omit_as_sybil, NULL);
|
|
|
}
|
|
|
|
|
@@ -2870,7 +2871,7 @@ dirserv_generate_networkstatus_vote_obj(crypto_pk_t *private_key,
|
|
|
* this must come before dirserv_compute_performance_thresholds() */
|
|
|
dirserv_count_measured_bws(routers);
|
|
|
|
|
|
- dirserv_compute_performance_thresholds(routers, omit_as_sybil);
|
|
|
+ dirserv_compute_performance_thresholds(omit_as_sybil);
|
|
|
|
|
|
routerstatuses = smartlist_new();
|
|
|
microdescriptors = smartlist_new();
|