diff options
author | Nick Mathewson <nickm@torproject.org> | 2019-01-11 18:53:24 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2019-01-11 18:53:24 -0500 |
commit | d21fa48cac0f41bd52306e269796559f75855323 (patch) | |
tree | 3f58bbe71874b15b205f47e7d7f7620388abbfbc /src/core | |
parent | 5dd926caa670002c6d2f15ac78e2282c00c352b6 (diff) | |
parent | efd765a94816bb216e81a4962c94bac385947719 (diff) | |
download | tor-d21fa48cac0f41bd52306e269796559f75855323.tar.gz tor-d21fa48cac0f41bd52306e269796559f75855323.zip |
Merge branch 'maint-0.3.5'
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/or/circuituse.c | 3 | ||||
-rw-r--r-- | src/core/or/connection_edge.c | 15 | ||||
-rw-r--r-- | src/core/or/connection_edge.h | 3 |
3 files changed, 19 insertions, 2 deletions
diff --git a/src/core/or/circuituse.c b/src/core/or/circuituse.c index e230ad1005..b7a4ab1b9e 100644 --- a/src/core/or/circuituse.c +++ b/src/core/or/circuituse.c @@ -2377,8 +2377,7 @@ circuit_get_open_circ_or_launch(entry_connection_t *conn, } else { hs_client_refetch_hsdesc(&edge_conn->hs_ident->identity_pk); } - connection_ap_mark_as_non_pending_circuit(conn); - ENTRY_TO_CONN(conn)->state = AP_CONN_STATE_RENDDESC_WAIT; + connection_ap_mark_as_waiting_for_renddesc(conn); return 0; } log_info(LD_REND,"Chose %s as intro point for '%s'.", diff --git a/src/core/or/connection_edge.c b/src/core/or/connection_edge.c index 33e4c6a4f4..93383a4e01 100644 --- a/src/core/or/connection_edge.c +++ b/src/core/or/connection_edge.c @@ -1368,6 +1368,21 @@ connection_ap_mark_as_non_pending_circuit(entry_connection_t *entry_conn) smartlist_remove(pending_entry_connections, entry_conn); } +/** Mark <b>entry_conn</b> as waiting for a rendezvous descriptor. This + * function will remove the entry connection from the waiting for a circuit + * list (pending_entry_connections). + * + * This pattern is used across the code base because a connection in state + * AP_CONN_STATE_RENDDESC_WAIT must not be in the pending list. */ +void +connection_ap_mark_as_waiting_for_renddesc(entry_connection_t *entry_conn) +{ + tor_assert(entry_conn); + + connection_ap_mark_as_non_pending_circuit(entry_conn); + ENTRY_TO_CONN(entry_conn)->state = AP_CONN_STATE_RENDDESC_WAIT; +} + /* DOCDOC */ void connection_ap_warn_and_unmark_if_pending_circ(entry_connection_t *entry_conn, diff --git a/src/core/or/connection_edge.h b/src/core/or/connection_edge.h index 55b90d3eae..b8a7365a05 100644 --- a/src/core/or/connection_edge.h +++ b/src/core/or/connection_edge.h @@ -126,6 +126,9 @@ void connection_ap_mark_as_pending_circuit_(entry_connection_t *entry_conn, #define connection_ap_mark_as_pending_circuit(c) \ connection_ap_mark_as_pending_circuit_((c), __FILE__, __LINE__) void connection_ap_mark_as_non_pending_circuit(entry_connection_t *entry_conn); +void connection_ap_mark_as_waiting_for_renddesc( + entry_connection_t *entry_conn); + #define CONNECTION_AP_EXPECT_NONPENDING(c) do { \ if (ENTRY_TO_CONN(c)->state == AP_CONN_STATE_CIRCUIT_WAIT) { \ log_warn(LD_BUG, "At %s:%d: %p was unexpectedly in circuit_wait.", \ |