summaryrefslogtreecommitdiff
path: root/src/or/entrynodes.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2017-05-22 09:09:16 -0400
committerNick Mathewson <nickm@torproject.org>2017-05-22 09:09:16 -0400
commitb2e9a107b7a69f29f88d9c5f67fea3cee3082cf0 (patch)
treea386bba6fc69ba446a7c71c934ca3d68f2234135 /src/or/entrynodes.c
parent90894c87a542c8671b4fb13d8e088e1e5c89d9b6 (diff)
parent52498b8183a2ab1da525180ee76f704d8257ebc6 (diff)
downloadtor-b2e9a107b7a69f29f88d9c5f67fea3cee3082cf0.tar.gz
tor-b2e9a107b7a69f29f88d9c5f67fea3cee3082cf0.zip
Merge remote-tracking branch 'asn/bug21969_bridges'
Diffstat (limited to 'src/or/entrynodes.c')
-rw-r--r--src/or/entrynodes.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/or/entrynodes.c b/src/or/entrynodes.c
index 51fda60116..c334a7aba0 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)