diff options
author | Nick Mathewson <nickm@torproject.org> | 2019-01-11 18:53:18 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2019-01-11 18:53:18 -0500 |
commit | efd765a94816bb216e81a4962c94bac385947719 (patch) | |
tree | 729bccd24fa912992a813edd6b79fd5eb413593e /src/core | |
parent | 694e3c57fd1af2cdaa4650d69c50f4108a8612f6 (diff) | |
parent | cec616a0c8ff060cb722e54342fd30aeab3ad285 (diff) | |
download | tor-efd765a94816bb216e81a4962c94bac385947719.tar.gz tor-efd765a94816bb216e81a4962c94bac385947719.zip |
Merge remote-tracking branch 'tor-github/pr/563' into 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 088358a4d6..7ea37fb3b5 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 2ec83c1204..57cb1194cf 100644 --- a/src/core/or/connection_edge.c +++ b/src/core/or/connection_edge.c @@ -1357,6 +1357,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.", \ |