diff options
author | George Kadianakis <desnacked@riseup.net> | 2017-05-22 14:10:38 +0300 |
---|---|---|
committer | George Kadianakis <desnacked@riseup.net> | 2017-05-22 15:56:32 +0300 |
commit | 6009c891655748eb2089afa8bc4a3d54ec2ddab9 (patch) | |
tree | 6d12156957a45250892d633d1f64e1dcb2b1b73b /src/or/entrynodes.c | |
parent | e102ad60d0490abf97102644960a9c602c658992 (diff) | |
download | tor-6009c891655748eb2089afa8bc4a3d54ec2ddab9.tar.gz tor-6009c891655748eb2089afa8bc4a3d54ec2ddab9.zip |
Set guard state on bridge descriptor fetches.
We used to not set the guard state in launch_direct_bridge_descriptor_fetch().
So when a bridge descriptor fetch failed, the guard subsystem would never
learn about the fail (and hence the guard's reachability state would not
be updated).
Diffstat (limited to 'src/or/entrynodes.c')
-rw-r--r-- | src/or/entrynodes.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/or/entrynodes.c b/src/or/entrynodes.c index 5b5e13bced..f8c702477b 100644 --- a/src/or/entrynodes.c +++ b/src/or/entrynodes.c @@ -2926,6 +2926,34 @@ entry_guard_get_by_id_digest(const char *digest) get_guard_selection_info(), digest); } +/** We are about to connect to bridge with identity <b>digest</b> to fetch its + * descriptor. Create a new guard state for this connection and return it. */ +circuit_guard_state_t * +get_guard_state_for_bridge_desc_fetch(const char *digest) +{ + circuit_guard_state_t *guard_state = NULL; + entry_guard_t *guard = NULL; + + guard = entry_guard_get_by_id_digest_for_guard_selection( + get_guard_selection_info(), digest); + if (!guard) { + return NULL; + } + + /* Update the guard last_tried_to_connect time since it's checked by the + * guard susbsystem. */ + guard->last_tried_to_connect = approx_time(); + + /* Create the guard state */ + guard_state = tor_malloc_zero(sizeof(circuit_guard_state_t)); + guard_state->guard = entry_guard_handle_new(guard); + guard_state->state = GUARD_CIRC_STATE_USABLE_ON_COMPLETION; + guard_state->state_set_at = approx_time(); + guard_state->restrictions = NULL; + + return guard_state; +} + /** Release all storage held by <b>e</b>. */ STATIC void entry_guard_free(entry_guard_t *e) |