summaryrefslogtreecommitdiff
path: root/src/or/entrynodes.c
diff options
context:
space:
mode:
authorteor <teor2345@gmail.com>2017-12-11 02:29:05 +1100
committerNick Mathewson <nickm@torproject.org>2017-12-12 19:17:25 -0500
commit19a4abf2a99c6a3de2c9a2fdf3e6d7b7c404f8f8 (patch)
tree48e37c5c8b39c91a4ee509b677d93a39822d1a2e /src/or/entrynodes.c
parent6b5c70670b26b9560febf5dc70f814d5e515c0f8 (diff)
downloadtor-19a4abf2a99c6a3de2c9a2fdf3e6d7b7c404f8f8.tar.gz
tor-19a4abf2a99c6a3de2c9a2fdf3e6d7b7c404f8f8.zip
Make sure bridges are definitely running before delaying directory fetches
Retry directory downloads when we get our first bridge descriptor during bootstrap or while reconnecting to the network. Keep retrying every time we get a bridge descriptor, until we have a reachable bridge. Stop delaying bridge descriptor fetches when we have cached bridge descriptors. Instead, only delay bridge descriptor fetches when we have at least one reachable bridge. Fixes bug 24367; bugfix on 0.2.0.3-alpha.
Diffstat (limited to 'src/or/entrynodes.c')
-rw-r--r--src/or/entrynodes.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/or/entrynodes.c b/src/or/entrynodes.c
index 100286f103..90b728726d 100644
--- a/src/or/entrynodes.c
+++ b/src/or/entrynodes.c
@@ -3135,13 +3135,16 @@ entry_list_is_constrained(const or_options_t *options)
}
/** Return the number of bridges that have descriptors that are marked with
- * purpose 'bridge' and are running.
+ * purpose 'bridge' and are running. If use_maybe_reachable is
+ * true, include bridges that might be reachable in the count.
+ * Otherwise, if it is false, only include bridges that have recently been
+ * found running in the count.
*
* We use this function to decide if we're ready to start building
* circuits through our bridges, or if we need to wait until the
* directory "server/authority" requests finish. */
MOCK_IMPL(int,
-num_bridges_usable,(void))
+num_bridges_usable,(int use_maybe_reachable))
{
int n_options = 0;
@@ -3154,8 +3157,12 @@ num_bridges_usable,(void))
}
SMARTLIST_FOREACH_BEGIN(gs->sampled_entry_guards, entry_guard_t *, guard) {
+ /* Definitely not usable */
if (guard->is_reachable == GUARD_REACHABLE_NO)
continue;
+ /* If we want to be really sure the bridges will work, skip maybes */
+ if (!use_maybe_reachable && guard->is_reachable == GUARD_REACHABLE_MAYBE)
+ continue;
if (tor_digest_is_zero(guard->identity))
continue;
const node_t *node = node_get_by_id(guard->identity);