Make sure ExcludeSingleHopRelays works for an exit.

svn:r16984
This commit is contained in:
Nick Mathewson 2008-09-26 19:09:12 +00:00
parent e147e867be
commit 745e5b0e22

View File

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