From ac67819396ac9e96c3dd65a5b5b23715e11eeec5 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Wed, 23 Nov 2016 10:04:23 -0500 Subject: Make sure primary-guards are up-to-date when we inspect them. (Plus some magic to prevent and detect recursive invocation of entry_guards_update_primary(), since that can cause some pretty tricky misbehavior.) --- src/or/entrynodes.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/or/entrynodes.h') diff --git a/src/or/entrynodes.h b/src/or/entrynodes.h index 4cbfbf55bf..a514c13a8e 100644 --- a/src/or/entrynodes.h +++ b/src/or/entrynodes.h @@ -222,6 +222,13 @@ struct guard_selection_s { */ int dirty; + /** + * A value of 1 means that primary_entry_guards is up-to-date; 0 + * means we need to recalculate it before using primary_entry_guards + * or the is_primary flag on any guard. + */ + int primary_guards_up_to_date; + /** * A list of the sampled entry guards, as entry_guard_t structures. * Not in any particular order. When we 'sample' a guard, we are @@ -428,6 +435,7 @@ STATIC void entry_guards_update_filtered_sets(guard_selection_t *gs); #define SAMPLE_EXCLUDE_CONFIRMED (1u<<0) #define SAMPLE_EXCLUDE_PRIMARY (1u<<1) #define SAMPLE_EXCLUDE_PENDING (1u<<2) +#define SAMPLE_NO_UPDATE_PRIMARY (1u<<3) /**@}*/ STATIC entry_guard_t *sample_reachable_filtered_entry_guards( guard_selection_t *gs, -- cgit v1.2.3-54-g00ecf