Skip to content

Commit

Permalink
Merge branch 'maint-0.4.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
dgoulet-tor committed Jun 25, 2020
2 parents fd5b2d0 + 68d848e commit c370b4a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
3 changes: 3 additions & 0 deletions changes/bug40001
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
o Minor features (entry guards):
- Reinstate support for GUARD NEW/UP/DOWN control port events.
Closes ticket 40001.
13 changes: 13 additions & 0 deletions src/feature/client/entrynodes.c
Original file line number Diff line number Diff line change
Expand Up @@ -906,6 +906,11 @@ entry_guard_add_to_sample_impl(guard_selection_t *gs,
guard->in_selection = gs;
entry_guard_set_filtered_flags(get_options(), gs, guard);
entry_guards_changed_for_guard_selection(gs);

/* Just added this guard to the sampled set and hence it might be used as a
* guard in the future: send GUARD NEW control event. */
control_event_guard(guard->nickname, guard->identity, "NEW");

return guard;
}

Expand Down Expand Up @@ -2259,6 +2264,9 @@ entry_guards_note_guard_failure(guard_selection_t *gs,
if (guard->failing_since == 0)
guard->failing_since = approx_time();

/* This guard not reachable: send GUARD DOWN event */
control_event_guard(guard->nickname, guard->identity, "DOWN");

log_info(LD_GUARD, "Recorded failure for %s%sguard %s",
guard->is_primary?"primary ":"",
guard->confirmed_idx>=0?"confirmed ":"",
Expand All @@ -2284,6 +2292,11 @@ entry_guards_note_guard_success(guard_selection_t *gs,
const time_t last_time_on_internet = gs->last_time_on_internet;
gs->last_time_on_internet = approx_time();

/* If guard was not already marked as reachable, send a GUARD UP signal */
if (guard->is_reachable != GUARD_REACHABLE_YES) {
control_event_guard(guard->nickname, guard->identity, "UP");
}

guard->is_reachable = GUARD_REACHABLE_YES;
guard->failing_since = 0;
guard->is_pending = 0;
Expand Down

0 comments on commit c370b4a

Please sign in to comment.