aboutsummaryrefslogtreecommitdiff
path: root/src/or/entrynodes.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/or/entrynodes.c')
-rw-r--r--src/or/entrynodes.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/or/entrynodes.c b/src/or/entrynodes.c
index 5b5e13bced..34dfdcef15 100644
--- a/src/or/entrynodes.c
+++ b/src/or/entrynodes.c
@@ -1104,6 +1104,21 @@ entry_guards_expand_sample(guard_selection_t *gs)
{
tor_assert(gs);
const or_options_t *options = get_options();
+
+ if (gs->type != GS_TYPE_BRIDGE) {
+ networkstatus_t *consensus = networkstatus_get_latest_consensus();
+ time_t now = approx_time();
+ if (consensus == NULL) {
+ log_info(LD_GUARD, "Not expanding the sample guard set; we have "
+ "no consensus.");
+ return NULL;
+ } else if (!networkstatus_consensus_reasonably_live(consensus, now)) {
+ log_info(LD_GUARD, "Not expanding the sample guard set; we have "
+ "a consensus, but it is far too old.");
+ return NULL;
+ }
+ }
+
int n_sampled = smartlist_len(gs->sampled_entry_guards);
entry_guard_t *added_guard = NULL;
int n_usable_filtered_guards = num_reachable_filtered_guards(gs, NULL);