summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2017-03-01 08:54:58 -0500
committerNick Mathewson <nickm@torproject.org>2017-03-01 08:54:58 -0500
commitd8fa6f9ddb74ced0b51a39608526eba0fc21135a (patch)
treea285127bb5edf11bcb373d587e6289211e40e933 /src
parentfa6b42699937f12c7a814edcff4ef8e17db086db (diff)
parent18a98206ede334c7332c43dc9f0b812611273f37 (diff)
downloadtor-d8fa6f9ddb74ced0b51a39608526eba0fc21135a.tar.gz
tor-d8fa6f9ddb74ced0b51a39608526eba0fc21135a.zip
Merge branch 'maint-0.3.0'
Diffstat (limited to 'src')
-rw-r--r--src/or/entrynodes.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/or/entrynodes.c b/src/or/entrynodes.c
index 3e871477b4..729e4b0391 100644
--- a/src/or/entrynodes.c
+++ b/src/or/entrynodes.c
@@ -1843,7 +1843,7 @@ select_entry_guard_for_circuit(guard_selection_t *gs,
if (! entry_guard_obeys_restriction(guard, rst))
continue;
if (guard->is_reachable != GUARD_REACHABLE_NO) {
- if (need_descriptor && BUG(!guard_has_descriptor(guard))) {
+ if (need_descriptor && !guard_has_descriptor(guard)) {
continue;
}
*state_out = GUARD_CIRC_STATE_USABLE_ON_COMPLETION;
@@ -3357,9 +3357,15 @@ guard_selection_have_enough_dir_info_to_build_circuits(guard_selection_t *gs)
if (!gs->primary_guards_up_to_date)
entry_guards_update_primary(gs);
- const int num_primary = get_n_primary_guards_to_use(GUARD_USAGE_TRAFFIC);
int n_missing_descriptors = 0;
int n_considered = 0;
+ int num_primary_to_check;
+
+ /* We want to check for the descriptor of at least the first two primary
+ * guards in our list, since these are the guards that we typically use for
+ * circuits. */
+ num_primary_to_check = get_n_primary_guards_to_use(GUARD_USAGE_TRAFFIC);
+ num_primary_to_check++;
SMARTLIST_FOREACH_BEGIN(gs->primary_entry_guards, entry_guard_t *, guard) {
entry_guard_consider_retry(guard);
@@ -3368,7 +3374,7 @@ guard_selection_have_enough_dir_info_to_build_circuits(guard_selection_t *gs)
n_considered++;
if (!guard_has_descriptor(guard))
n_missing_descriptors++;
- if (n_considered >= num_primary)
+ if (n_considered >= num_primary_to_check)
break;
} SMARTLIST_FOREACH_END(guard);