mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-30 23:53:32 +01:00
best_support_idx is obsolete
(also doesn't fix the bug) svn:r1097
This commit is contained in:
parent
bd14023afd
commit
46ffc5984d
@ -222,7 +222,6 @@ static routerinfo_t *choose_good_exit_server(routerlist_t *dir)
|
||||
connection_t **carray;
|
||||
int n_connections;
|
||||
int best_support = -1;
|
||||
int best_support_idx = -1;
|
||||
int n_best_support=0;
|
||||
smartlist_t *sl, *preferredexits, *excludedexits;
|
||||
routerinfo_t *router;
|
||||
@ -283,7 +282,7 @@ static routerinfo_t *choose_good_exit_server(routerlist_t *dir)
|
||||
if (n_supported[i] > best_support) {
|
||||
/* If this router is better than previous ones, remember its index
|
||||
* and goodness, and start counting how many routers are this good. */
|
||||
best_support = n_supported[i]; best_support_idx = i; n_best_support=1;
|
||||
best_support = n_supported[i]; n_best_support=1;
|
||||
log_fn(LOG_DEBUG,"%s is new best supported option so far.",
|
||||
dir->routers[i]->nickname);
|
||||
} else if (n_supported[i] == best_support) {
|
||||
@ -306,7 +305,7 @@ static routerinfo_t *choose_good_exit_server(routerlist_t *dir)
|
||||
/* If any routers definitely support any pending connections, choose one
|
||||
* at random. */
|
||||
if (best_support > 0) {
|
||||
for (i = best_support_idx; i < dir->n_routers; i++)
|
||||
for (i = 0; i < dir->n_routers; i++)
|
||||
if (n_supported[i] == best_support)
|
||||
smartlist_add(sl, dir->routers[i]);
|
||||
|
||||
@ -320,7 +319,7 @@ static routerinfo_t *choose_good_exit_server(routerlist_t *dir)
|
||||
if (best_support == -1) {
|
||||
log(LOG_WARN, "All routers are down or middleman -- choosing a doomed exit at random.");
|
||||
}
|
||||
for(i = best_support_idx; i < dir->n_routers; i++)
|
||||
for(i = 0; i < dir->n_routers; i++)
|
||||
if(n_supported[i] != -1)
|
||||
smartlist_add(sl, dir->routers[i]);
|
||||
|
||||
@ -336,10 +335,6 @@ static routerinfo_t *choose_good_exit_server(routerlist_t *dir)
|
||||
tor_free(n_supported);
|
||||
if(router) {
|
||||
log_fn(LOG_WARN, "Chose exit server '%s'", router->nickname);
|
||||
if(router_exit_policy_rejects_all(router))
|
||||
log_fn(LOG_WARN,"...which will reject all. Bug.");
|
||||
if(!strcmp(router->nickname,"tor26") || !strcmp(router->nickname,"jap"))
|
||||
log_fn(LOG_WARN,"...which is tor26 or jap, which should reject all.");
|
||||
return router;
|
||||
}
|
||||
log_fn(LOG_WARN, "No exit routers seem to be running; can't choose an exit.");
|
||||
|
@ -419,7 +419,7 @@ int router_compare_addr_to_exit_policy(uint32_t addr, uint16_t port,
|
||||
/* The exit policy is reject ???:port */
|
||||
maybe_reject = 1;
|
||||
} else {
|
||||
/* The exit policy is acccept ???:port */
|
||||
/* The exit policy is accept ???:port */
|
||||
maybe_accept = 1;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user