aboutsummaryrefslogtreecommitdiff
path: root/src/or
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2007-11-16 07:37:49 +0000
committerRoger Dingledine <arma@torproject.org>2007-11-16 07:37:49 +0000
commitd09439872d81046d6edee7a4fa03fc4b68db8ab3 (patch)
treefae34c198da27e1c04cf97b3032b45a4080396bd /src/or
parentb669fb7344057e943081e42b6b123a4cd1e25d51 (diff)
downloadtor-d09439872d81046d6edee7a4fa03fc4b68db8ab3.tar.gz
tor-d09439872d81046d6edee7a4fa03fc4b68db8ab3.zip
If we're using bridges or have strictentrynodes set, and our
chosen exit is in the same family as all our bridges/entry guards, then be flexible about families. svn:r12514
Diffstat (limited to 'src/or')
-rw-r--r--src/or/circuitbuild.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index 82ebc28d7b..6b159ec6f5 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -2443,10 +2443,12 @@ choose_random_entry(cpath_build_state_t *state)
routerinfo_t *r = NULL;
int need_uptime = state ? state->need_uptime : 0;
int need_capacity = state ? state->need_capacity : 0;
+ int consider_exit_family = 0;
if (chosen_exit) {
smartlist_add(exit_family, chosen_exit);
routerlist_add_family(exit_family, chosen_exit);
+ consider_exit_family = 1;
}
if (!entry_guards)
@@ -2465,7 +2467,7 @@ choose_random_entry(cpath_build_state_t *state)
SMARTLIST_FOREACH(entry_guards, entry_guard_t *, entry,
{
r = entry_is_live(entry, need_uptime, need_capacity, 0);
- if (r && !smartlist_isin(exit_family, r)) {
+ if (r && (!consider_exit_family || !smartlist_isin(exit_family, r))) {
smartlist_add(live_entry_guards, r);
if (!entry->made_contact) {
/* Always start with the first not-yet-contacted entry
@@ -2504,6 +2506,13 @@ choose_random_entry(cpath_build_state_t *state)
need_capacity = 0;
goto retry;
}
+ if (!r && !can_grow_entry_list(options) && consider_exit_family) {
+ /* still no? if we're using bridges or have strictentrynodes
+ * set, and our chosen exit is in the same family as all our
+ * bridges/entry guards, then be flexible about families. */
+ consider_exit_family = 0;
+ goto retry;
+ }
/* live_entry_guards may be empty below. Oh well, we tried. */
}