diff options
author | Nick Mathewson <nickm@torproject.org> | 2015-12-16 18:49:23 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2015-12-16 18:49:23 -0500 |
commit | 613e0e1c1ac3e44bad7a876147c49bc232460df2 (patch) | |
tree | 9bd37585ab25a186fb174ef1ed6e0bd79589744c | |
parent | 3317cd3a1f4e3a7883bf9a5eba3f9a13097fe437 (diff) | |
download | tor-613e0e1c1ac3e44bad7a876147c49bc232460df2.tar.gz tor-613e0e1c1ac3e44bad7a876147c49bc232460df2.zip |
Move pending-connection code into connection_ap_about_to_close
It is AP-specific, so that's where it belongs. This shouldn't have
caused a bug, but due to #17876, we were never actually calling
connection_edge_about_to_close from connection_ap_about_to_close,
causing bug #17874 (aka bug #17752).
-rw-r--r-- | src/or/connection_edge.c | 37 |
1 files changed, 16 insertions, 21 deletions
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c index 961e49abd9..fdb16a2dc3 100644 --- a/src/or/connection_edge.c +++ b/src/or/connection_edge.c @@ -527,27 +527,6 @@ connection_edge_about_to_close(edge_connection_t *edge_conn) conn->marked_for_close_file, conn->marked_for_close); tor_fragile_assert(); } - - if (TO_CONN(edge_conn)->type != CONN_TYPE_AP || - PREDICT_UNLIKELY(NULL == pending_entry_connections)) - return; - - entry_connection_t *entry_conn = EDGE_TO_ENTRY_CONN(edge_conn); - - if (TO_CONN(edge_conn)->state == AP_CONN_STATE_CIRCUIT_WAIT) { - smartlist_remove(pending_entry_connections, entry_conn); - } - -#if 1 - /* Check to make sure that this isn't in pending_entry_connections if it - * didn't actually belong there. */ - if (TO_CONN(edge_conn)->type == CONN_TYPE_AP && - smartlist_contains(pending_entry_connections, entry_conn)) { - log_warn(LD_BUG, "What was %p doing in pending_entry_connections???", - entry_conn); - smartlist_remove(pending_entry_connections, entry_conn); - } -#endif } /** Called when we're about to finally unlink and free an AP (client) @@ -577,6 +556,22 @@ connection_ap_about_to_close(entry_connection_t *entry_conn) conn->marked_for_close_file, conn->marked_for_close); dnsserv_reject_request(entry_conn); } + + if (TO_CONN(edge_conn)->state == AP_CONN_STATE_CIRCUIT_WAIT) { + smartlist_remove(pending_entry_connections, entry_conn); + } + +#if 1 + /* Check to make sure that this isn't in pending_entry_connections if it + * didn't actually belong there. */ + if (TO_CONN(edge_conn)->type == CONN_TYPE_AP && + smartlist_contains(pending_entry_connections, entry_conn)) { + log_warn(LD_BUG, "What was %p doing in pending_entry_connections???", + entry_conn); + smartlist_remove(pending_entry_connections, entry_conn); + } +#endif + control_event_stream_bandwidth(edge_conn); control_event_stream_status(entry_conn, STREAM_EVENT_CLOSED, edge_conn->end_reason); |