diff options
author | Roger Dingledine <arma@torproject.org> | 2008-03-24 05:48:51 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2008-03-24 05:48:51 +0000 |
commit | a9acdb8f53d408248ae6fa1b803a6c259a34854c (patch) | |
tree | be5186ce0637013bc8db0cebbaf52db3e804ee6b /src/or/connection_edge.c | |
parent | c26c77d24da5e2330225caba3b39614aec06d431 (diff) | |
download | tor-a9acdb8f53d408248ae6fa1b803a6c259a34854c.tar.gz tor-a9acdb8f53d408248ae6fa1b803a6c259a34854c.zip |
when our onehop circuits were failing, nobody was telling the
streams. so they waited 120 seconds before timing out. this
was particularly bad during bootstrapping, if an authority is
down or not answering right.
svn:r14163
Diffstat (limited to 'src/or/connection_edge.c')
-rw-r--r-- | src/or/connection_edge.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c index a231623981..7d5c4ffb7e 100644 --- a/src/or/connection_edge.c +++ b/src/or/connection_edge.c @@ -460,6 +460,35 @@ connection_ap_attach_pending(void) }); } +/** Tell any AP streams that are waiting for a onehop tunnel to + * <b>failed_digest</b> that they are going to fail. */ +/* XXX021 We should get rid of this function, and instead attach + * onehop streams to circ->p_streams so they get marked in + * circuit_mark_for_close like normal p_streams. */ +void +connection_ap_fail_onehop(const char *failed_digest) +{ + edge_connection_t *edge_conn; + char digest[DIGEST_LEN]; + smartlist_t *conns = get_connection_array(); + SMARTLIST_FOREACH(conns, connection_t *, conn, + { + if (conn->marked_for_close || + conn->type != CONN_TYPE_AP || + conn->state != AP_CONN_STATE_CIRCUIT_WAIT) + continue; + edge_conn = TO_EDGE_CONN(conn); + if (!edge_conn->want_onehop) + continue; + if (!hexdigest_to_digest(edge_conn->chosen_exit_name, digest) && + !memcmp(digest, failed_digest, DIGEST_LEN)) { + log_info(LD_APP, "Closing onehop stream to '%s' because the OR conn " + "just failed.", edge_conn->chosen_exit_name); + connection_mark_unattached_ap(edge_conn, END_STREAM_REASON_TIMEOUT); + } + }); +} + /** A circuit failed to finish on its last hop <b>info</b>. If there * are any streams waiting with this exit node in mind, but they * don't absolutely require it, make them give up on it. |