diff options
author | Roger Dingledine <arma@torproject.org> | 2007-07-02 22:15:26 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2007-07-02 22:15:26 +0000 |
commit | 99bfb1bebe20c1502c782f94c0366aa4f337131d (patch) | |
tree | ce273dda358f9c2a2808b4da6229d1e4c8c4d2b9 /src/or | |
parent | 5c1daed3adc652a6dfe0c2e4373dbc03b0a23945 (diff) | |
download | tor-99bfb1bebe20c1502c782f94c0366aa4f337131d.tar.gz tor-99bfb1bebe20c1502c782f94c0366aa4f337131d.zip |
If there's a never-before-connected-to guard node in our list,
never choose any guards past it. This way we don't expand our
guard list unless we need to. [Bugfix in 0.1.2.x]
I'm not sure if this will solve all our problems, but it is at least
something.
svn:r10730
Diffstat (limited to 'src/or')
-rw-r--r-- | src/or/circuitbuild.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c index b8085e8fd7..c0c5965a34 100644 --- a/src/or/circuitbuild.c +++ b/src/or/circuitbuild.c @@ -2418,6 +2418,13 @@ choose_random_entry(cpath_build_state_t *state) r = entry_is_live(entry, need_uptime, need_capacity, 0); if (r && !smartlist_isin(exit_family, r)) { smartlist_add(live_entry_guards, r); + if (!entry->made_contact) { + /* Always start with the first not-yet-contacted entry + * guard. Otherwise we might add several new ones, pick + * the second new one, and now we've expanded our entry + * guard list without needing to. */ + goto choose_and_finish; + } if (smartlist_len(live_entry_guards) >= options->NumEntryGuards) break; /* we have enough */ } @@ -2451,6 +2458,7 @@ choose_random_entry(cpath_build_state_t *state) /* live_entry_guards may be empty below. Oh well, we tried. */ } + choose_and_finish: r = smartlist_choose(live_entry_guards); smartlist_free(live_entry_guards); smartlist_free(exit_family); |