summaryrefslogtreecommitdiff
path: root/src/or/rendclient.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2015-11-13 13:38:01 -0500
committerNick Mathewson <nickm@torproject.org>2015-11-17 08:53:34 -0500
commitb1d56fc5890fb6d594e70520c09d040e9b2e1544 (patch)
tree8777eb9aaa8b1f53ad136b34c4408fa0f1a0b899 /src/or/rendclient.c
parentb91bd27e6f94e76359097e1ec53494ea5168108d (diff)
downloadtor-b1d56fc5890fb6d594e70520c09d040e9b2e1544.tar.gz
tor-b1d56fc5890fb6d594e70520c09d040e9b2e1544.zip
Decouple ..attach_circuit() from most of its callers.
Long ago we used to call connection_ap_handshake_attach_circuit() only in a few places, since connection_ap_attach_pending() attaches all the pending connections, and does so regularly. But this turned out to have a performance problem: it would introduce a delay to launching or connecting a stream. We couldn't just call connection_ap_attach_pending() every time we make a new connection, since it walks the whole connection list. So we started calling connection_ap_attach_pending all over, instead! But that's kind of ugly and messes up our callgraph. So instead, we now have connection_ap_attach_pending() use a list only of the pending connections, so we can call it much more frequently. We have a separate function to scan the whole connection array to see if we missed adding anything, and log a warning if so. Closes ticket #17590
Diffstat (limited to 'src/or/rendclient.c')
-rw-r--r--src/or/rendclient.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/src/or/rendclient.c b/src/or/rendclient.c
index a39e518e99..3846ef0c32 100644
--- a/src/or/rendclient.c
+++ b/src/or/rendclient.c
@@ -1226,12 +1226,7 @@ rend_client_desc_trynow(const char *query)
base_conn->timestamp_lastread = now;
base_conn->timestamp_lastwritten = now;
- if (connection_ap_handshake_attach_circuit(conn) < 0) {
- /* it will never work */
- log_warn(LD_REND,"Rendezvous attempt failed. Closing.");
- if (!base_conn->marked_for_close)
- connection_mark_unattached_ap(conn, END_STREAM_REASON_CANT_ATTACH);
- }
+ connection_ap_mark_as_pending_circuit(conn);
} else { /* 404, or fetch didn't get that far */
log_notice(LD_REND,"Closing stream for '%s.onion': hidden service is "
"unavailable (try again later).",