diff options
author | Roger Dingledine <arma@torproject.org> | 2008-03-24 19:14:48 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2008-03-24 19:14:48 +0000 |
commit | 981ad6021d16ac580ab638afc46956dc50c12a7c (patch) | |
tree | e8d4c8c42488700252c7b7183edf2d9d15027bb3 /src/or/connection_edge.c | |
parent | ef551d7d263d6dcc569c647e7b2bd5385b11dded (diff) | |
download | tor-981ad6021d16ac580ab638afc46956dc50c12a7c.tar.gz tor-981ad6021d16ac580ab638afc46956dc50c12a7c.zip |
backport r14162-r14164
svn:r14167
Diffstat (limited to 'src/or/connection_edge.c')
-rw-r--r-- | src/or/connection_edge.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c index ee60dbff5a..baf344b99b 100644 --- a/src/or/connection_edge.c +++ b/src/or/connection_edge.c @@ -457,6 +457,32 @@ 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. */ +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. |