summaryrefslogtreecommitdiff
path: root/src/or/connection_edge.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2006-10-01 06:41:13 +0000
committerRoger Dingledine <arma@torproject.org>2006-10-01 06:41:13 +0000
commit4096e577c51a6eae88ab26cb4931998b0486e678 (patch)
treefa01f2a89a28aab3ef1828604e33b012a04d6db7 /src/or/connection_edge.c
parent96a4cb1dfa4d65c6c57261f038aa5bdf6e776ac2 (diff)
downloadtor-4096e577c51a6eae88ab26cb4931998b0486e678.tar.gz
tor-4096e577c51a6eae88ab26cb4931998b0486e678.zip
if we fail to build a circuit to an intended enclave, and it's
not mandatory that we use that enclave, stop wanting it. svn:r8559
Diffstat (limited to 'src/or/connection_edge.c')
-rw-r--r--src/or/connection_edge.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c
index 2814108d94..c02999affb 100644
--- a/src/or/connection_edge.c
+++ b/src/or/connection_edge.c
@@ -453,6 +453,41 @@ connection_ap_attach_pending(void)
}
}
+/** 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.
+ */
+void
+circuit_discard_optional_exit_enclaves(extend_info_t *info)
+{
+ connection_t **carray;
+ connection_t *conn;
+ edge_connection_t *edge_conn;
+ routerinfo_t *r1, *r2;
+ int n, i;
+
+ get_connection_array(&carray, &n);
+
+ for (i = 0; i < n; ++i) {
+ conn = carray[i];
+ if (conn->marked_for_close ||
+ conn->type != CONN_TYPE_AP ||
+ !conn->chosen_exit_optional)
+ continue;
+ edge_conn = TO_EDGE_CONN(conn);
+ r1 = router_get_by_nickname(edge_conn->chosen_exit_name, 0);
+ r2 = router_get_by_nickname(info->nickname, 0);
+ if (r1 && r2 && r1==r2) {
+ tor_assert(edge_conn->socks_request);
+ log_info(LD_APP, "Giving up on enclave exit '%s' for destination %s.",
+ safe_str(edge_conn->chosen_exit_name),
+ escaped_safe_str(edge_conn->socks_request->address));
+ conn->chosen_exit_optional = 0;
+ tor_free(edge_conn->chosen_exit_name); /* clears it */
+ }
+ }
+}
+
/** 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