diff options
author | Nick Mathewson <nickm@torproject.org> | 2011-07-20 09:50:53 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2011-07-20 09:50:53 -0400 |
commit | eaa1c05397c1a6cf2f58b7c41e388311d5aa8ffb (patch) | |
tree | b304aaca9b8d5364517d4ab23ffd232cf420858d /src/or/circuituse.c | |
parent | 195bcb6150eeaebab31a44998e2c567d78f9b936 (diff) | |
parent | 9a7c16fb00c6ffc32ef7d6cc7fbede5258fe4390 (diff) | |
download | tor-eaa1c05397c1a6cf2f58b7c41e388311d5aa8ffb.tar.gz tor-eaa1c05397c1a6cf2f58b7c41e388311d5aa8ffb.zip |
Merge branch 'optimistic-client'
The conflicts are with the proposal 171 circuit isolation code, and
they're all trivial: they're just a matter of both branches adding
some unrelated code in the same places.
Conflicts:
src/or/circuituse.c
src/or/connection.c
Diffstat (limited to 'src/or/circuituse.c')
-rw-r--r-- | src/or/circuituse.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/or/circuituse.c b/src/or/circuituse.c index b4860440cb..1bc518b7d4 100644 --- a/src/or/circuituse.c +++ b/src/or/circuituse.c @@ -738,6 +738,7 @@ circuit_detach_stream(circuit_t *circ, edge_connection_t *conn) tor_assert(conn); conn->cpath_layer = NULL; /* make sure we don't keep a stale pointer */ + conn->exit_allows_optimistic_data = 0; conn->on_circuit = NULL; if (CIRCUIT_IS_ORIGIN(circ)) { @@ -1548,6 +1549,8 @@ static void link_apconn_to_circ(edge_connection_t *apconn, origin_circuit_t *circ, crypt_path_t *cpath) { + const node_t *exitnode; + /* add it into the linked list of streams on this circuit */ log_debug(LD_APP|LD_CIRC, "attaching new conn to circ. n_circ_id %d.", circ->_base.n_circ_id); @@ -1570,6 +1573,24 @@ link_apconn_to_circ(edge_connection_t *apconn, origin_circuit_t *circ, circ->isolation_any_streams_attached = 1; connection_edge_update_circuit_isolation(apconn, circ, 0); + + /* See if we can use optimistic data on this circuit */ + if (apconn->cpath_layer->extend_info && + (exitnode = node_get_by_id( + apconn->cpath_layer->extend_info->identity_digest)) && + exitnode->rs) { + /* Okay; we know what exit node this is. */ + if (circ->_base.purpose == CIRCUIT_PURPOSE_C_GENERAL && + exitnode->rs->version_supports_optimistic_data) + apconn->exit_allows_optimistic_data = 1; + else + apconn->exit_allows_optimistic_data = 0; + log_info(LD_APP, "Looks like completed circuit to %s %s allow " + "optimistic data for connection to %s", + safe_str_client(node_describe(exitnode)), + apconn->exit_allows_optimistic_data ? "does" : "doesn't", + safe_str_client(apconn->socks_request->address)); + } } /** Return true iff <b>address</b> is matched by one of the entries in |