summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2004-02-17 08:42:25 +0000
committerRoger Dingledine <arma@torproject.org>2004-02-17 08:42:25 +0000
commit46ffc5984d789e1ea7f334e3188838a7a63c553c (patch)
tree75c99f84effeb2717e50eef1809cbe940b52f7c1
parentbd14023afd24abef9f74e7cf6e97cd742a0c7b9e (diff)
downloadtor-46ffc5984d789e1ea7f334e3188838a7a63c553c.tar.gz
tor-46ffc5984d789e1ea7f334e3188838a7a63c553c.zip
best_support_idx is obsolete
(also doesn't fix the bug) svn:r1097
-rw-r--r--src/or/onion.c11
-rw-r--r--src/or/routerlist.c2
2 files changed, 4 insertions, 9 deletions
diff --git a/src/or/onion.c b/src/or/onion.c
index b5cc3f9546..ce132177c6 100644
--- a/src/or/onion.c
+++ b/src/or/onion.c
@@ -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.");
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index 0d44ffd30f..3c9281d5f7 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -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;
}
}