aboutsummaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2020-08-03 08:33:22 -0400
committerNick Mathewson <nickm@torproject.org>2020-08-03 08:33:22 -0400
commit3e3b0b0443b6486553e5cfc18a23a8d7cb7ae4c4 (patch)
tree2d01799c58eb2c9edfe0eba70e3e67d19b5c39e8 /src/core
parentefe8a988172422285762459e820d3cbcce5a6b10 (diff)
parent837e0c4dc93bd035298551c35db5be2ed18ee5dc (diff)
downloadtor-3e3b0b0443b6486553e5cfc18a23a8d7cb7ae4c4.tar.gz
tor-3e3b0b0443b6486553e5cfc18a23a8d7cb7ae4c4.zip
Merge remote-tracking branch 'tor-github/pr/1986/head'
Diffstat (limited to 'src/core')
-rw-r--r--src/core/or/connection_edge.c16
-rw-r--r--src/core/or/connection_edge.h2
2 files changed, 14 insertions, 4 deletions
diff --git a/src/core/or/connection_edge.c b/src/core/or/connection_edge.c
index ed27fb1b57..25337f0720 100644
--- a/src/core/or/connection_edge.c
+++ b/src/core/or/connection_edge.c
@@ -1553,6 +1553,16 @@ circuit_discard_optional_exit_enclaves(extend_info_t *info)
} SMARTLIST_FOREACH_END(conn);
}
+/** Set the connection state to CONTROLLER_WAIT and send an control port event.
+ */
+void
+connection_entry_set_controller_wait(entry_connection_t *conn)
+{
+ CONNECTION_AP_EXPECT_NONPENDING(conn);
+ ENTRY_TO_CONN(conn)->state = AP_CONN_STATE_CONTROLLER_WAIT;
+ control_event_stream_status(conn, STREAM_EVENT_CONTROLLER_WAIT, 0);
+}
+
/** The AP connection <b>conn</b> has just failed while attaching or
* sending a BEGIN or resolving on <b>circ</b>, but another circuit
* might work. Detach the circuit, and either reattach it, launch a
@@ -1584,8 +1594,7 @@ connection_ap_detach_retriable(entry_connection_t *conn,
circuit_detach_stream(TO_CIRCUIT(circ),ENTRY_TO_EDGE_CONN(conn));
connection_ap_mark_as_pending_circuit(conn);
} else {
- CONNECTION_AP_EXPECT_NONPENDING(conn);
- ENTRY_TO_CONN(conn)->state = AP_CONN_STATE_CONTROLLER_WAIT;
+ connection_entry_set_controller_wait(conn);
circuit_detach_stream(TO_CIRCUIT(circ),ENTRY_TO_EDGE_CONN(conn));
}
return 0;
@@ -1738,8 +1747,7 @@ connection_ap_rewrite_and_attach_if_allowed,(entry_connection_t *conn,
const or_options_t *options = get_options();
if (options->LeaveStreamsUnattached) {
- CONNECTION_AP_EXPECT_NONPENDING(conn);
- ENTRY_TO_CONN(conn)->state = AP_CONN_STATE_CONTROLLER_WAIT;
+ connection_entry_set_controller_wait(conn);
return 0;
}
return connection_ap_handshake_rewrite_and_attach(conn, circ, cpath);
diff --git a/src/core/or/connection_edge.h b/src/core/or/connection_edge.h
index 9b2cbb8532..c9433adade 100644
--- a/src/core/or/connection_edge.h
+++ b/src/core/or/connection_edge.h
@@ -98,6 +98,8 @@ int connection_edge_flushed_some(edge_connection_t *conn);
int connection_edge_finished_flushing(edge_connection_t *conn);
int connection_edge_finished_connecting(edge_connection_t *conn);
+void connection_entry_set_controller_wait(entry_connection_t *conn);
+
void connection_ap_about_to_close(entry_connection_t *edge_conn);
void connection_exit_about_to_close(edge_connection_t *edge_conn);