summaryrefslogtreecommitdiff
path: root/src/or/routerlist.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2008-09-26 18:58:45 +0000
committerNick Mathewson <nickm@torproject.org>2008-09-26 18:58:45 +0000
commite147e867bea13515c964e823e3f98c28f90cf22c (patch)
treea8af8f882985c2edfa36f1eee2e44de17a6a4a80 /src/or/routerlist.c
parent87eb230c01693c0cdb81d05a6bd2c866874c5e3a (diff)
downloadtor-e147e867bea13515c964e823e3f98c28f90cf22c.tar.gz
tor-e147e867bea13515c964e823e3f98c28f90cf22c.zip
Proposal 152 implementation from Josh Albrecht, with tweaks.
svn:r16983
Diffstat (limited to 'src/or/routerlist.c')
-rw-r--r--src/or/routerlist.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index 3a5c4d5998..be38cc569e 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -1767,6 +1767,16 @@ router_choose_random_node(const char *preferred,
excludednodes = smartlist_create();
+ /* Exclude relays that allow single hop exit circuits, if the user
+ * wants to (such relays might be risky) */
+ if (get_options()->ExcludeSingleHopRelays) {
+ routerlist_t *rl = router_get_routerlist();
+ SMARTLIST_FOREACH(rl->routers, routerinfo_t *, r,
+ if (r->allow_single_hop_exits) {
+ smartlist_add(excludednodes, r);
+ });
+ }
+
if ((r = routerlist_find_my_routerinfo())) {
smartlist_add(excludednodes, r);
routerlist_add_family(excludednodes, r);