summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2008-09-26 19:09:12 +0000
committerNick Mathewson <nickm@torproject.org>2008-09-26 19:09:12 +0000
commit745e5b0e22f98aced0666b7849aa81c4a6de1802 (patch)
tree4ce7726860b7b98a9a0317592efc51426ed2253a
parente147e867bea13515c964e823e3f98c28f90cf22c (diff)
downloadtor-745e5b0e22f98aced0666b7849aa81c4a6de1802.tar.gz
tor-745e5b0e22f98aced0666b7849aa81c4a6de1802.zip
Make sure ExcludeSingleHopRelays works for an exit.
svn:r16984
-rw-r--r--src/or/circuitbuild.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index 42ccae71aa..c7b780d99a 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -1197,8 +1197,6 @@ choose_good_exit_server_general(routerlist_t *dir, int need_uptime,
connections = get_connection_array();
- /* XXXX021 Respect ExcludeSingleHopRelays here. */
-
/* Count how many connections are waiting for a circuit to be built.
* We use this for log messages now, but in the future we may depend on it.
*/
@@ -1213,6 +1211,8 @@ choose_good_exit_server_general(routerlist_t *dir, int need_uptime,
* of the pending connections could possibly exit from that
* router (n_supported[i]). (We can't be sure about cases where we
* don't know the IP address of the pending connection.)
+ *
+ * -1 means "Don't use this router at all."
*/
n_supported = tor_malloc(sizeof(int)*smartlist_len(dir->routers));
for (i = 0; i < smartlist_len(dir->routers); ++i) {/* iterate over routers */
@@ -1240,6 +1240,10 @@ choose_good_exit_server_general(routerlist_t *dir, int need_uptime,
// router->nickname, i);
continue; /* skip invalid routers */
}
+ if (options->ExcludeSingleHopRelays && router->allow_single_hop_exits) {
+ n_supported[i] = -1;
+ continue;
+ }
if (router_exit_policy_rejects_all(router)) {
n_supported[i] = -1;
// log_fn(LOG_DEBUG,"Skipping node %s (index %d) -- it rejects all.",
@@ -2460,8 +2464,6 @@ choose_random_entry(cpath_build_state_t *state)
consider_exit_family = 1;
}
- /* XXXX021 Respect ExcludeSingleHopRelays here. */
-
if (!entry_guards)
entry_guards = smartlist_create();