diff options
author | David Goulet <dgoulet@torproject.org> | 2020-06-25 07:36:56 -0400 |
---|---|---|
committer | David Goulet <dgoulet@torproject.org> | 2020-06-25 07:36:56 -0400 |
commit | c370b4a049bd99e45b2dcfd4b0824901234f8b17 (patch) | |
tree | c85c13cc7b4738824818a09a73df539823b8a50a | |
parent | fd5b2d0f1c8a83d10e9a07f88cf8d9e69c98774a (diff) | |
parent | 68d848e244cf274d1a1df4da2f9adca2aaffec19 (diff) | |
download | tor-c370b4a049bd99e45b2dcfd4b0824901234f8b17.tar.gz tor-c370b4a049bd99e45b2dcfd4b0824901234f8b17.zip |
Merge branch 'maint-0.4.4'
-rw-r--r-- | changes/bug40001 | 3 | ||||
-rw-r--r-- | src/feature/client/entrynodes.c | 13 |
2 files changed, 16 insertions, 0 deletions
diff --git a/changes/bug40001 b/changes/bug40001 new file mode 100644 index 0000000000..0e3f454619 --- /dev/null +++ b/changes/bug40001 @@ -0,0 +1,3 @@ + o Minor features (entry guards): + - Reinstate support for GUARD NEW/UP/DOWN control port events. + Closes ticket 40001.
\ No newline at end of file diff --git a/src/feature/client/entrynodes.c b/src/feature/client/entrynodes.c index 2a000a47b6..223815e7b2 100644 --- a/src/feature/client/entrynodes.c +++ b/src/feature/client/entrynodes.c @@ -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; } @@ -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 ":"", @@ -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; |