summaryrefslogtreecommitdiff
path: root/src/or/circuituse.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2014-09-21 19:12:20 -0400
committerRoger Dingledine <arma@torproject.org>2014-09-21 19:12:20 -0400
commit530fac10aaef5e38327c8704d657a2e67987f102 (patch)
tree0f5624acd37912e628c419f532e0b49f12f245df /src/or/circuituse.c
parentbbfb1aca55303c150ebb08e223a0d9a69bb5be26 (diff)
downloadtor-530fac10aaef5e38327c8704d657a2e67987f102.tar.gz
tor-530fac10aaef5e38327c8704d657a2e67987f102.zip
Use optimistic data even if we don't know exitnode->rs
I think we should know the routerstatus for our exit relay, since we built a circuit to it. So I think this is just a code simplication.
Diffstat (limited to 'src/or/circuituse.c')
-rw-r--r--src/or/circuituse.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/or/circuituse.c b/src/or/circuituse.c
index cb2d7e2b68..c1a81520e7 100644
--- a/src/or/circuituse.c
+++ b/src/or/circuituse.c
@@ -2070,7 +2070,7 @@ static void
link_apconn_to_circ(entry_connection_t *apconn, origin_circuit_t *circ,
crypt_path_t *cpath)
{
- const node_t *exitnode;
+ const node_t *exitnode = NULL;
/* 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 %u.",
@@ -2104,22 +2104,22 @@ link_apconn_to_circ(entry_connection_t *apconn, origin_circuit_t *circ,
circ->isolation_any_streams_attached = 1;
connection_edge_update_circuit_isolation(apconn, circ, 0);
+ /* Compute the exitnode if possible, for logging below */
+ if (cpath->extend_info)
+ exitnode = node_get_by_id(cpath->extend_info->identity_digest);
+
/* See if we can use optimistic data on this circuit */
- if (cpath->extend_info &&
- (exitnode = node_get_by_id(cpath->extend_info->identity_digest)) &&
- exitnode->rs) {
- /* Okay; we know what exit node this is. */
- if (optimistic_data_enabled() &&
- circ->base_.purpose == CIRCUIT_PURPOSE_C_GENERAL)
- apconn->may_use_optimistic_data = 1;
- else
- apconn->may_use_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->may_use_optimistic_data ? "does" : "doesn't",
- safe_str_client(apconn->socks_request->address));
- }
+ if (optimistic_data_enabled() &&
+ circ->base_.purpose == CIRCUIT_PURPOSE_C_GENERAL)
+ apconn->may_use_optimistic_data = 1;
+ else
+ apconn->may_use_optimistic_data = 0;
+ log_info(LD_APP, "Looks like completed circuit to %s %s allow "
+ "optimistic data for connection to %s",
+ /* node_describe() does the right thing if exitnode is NULL */
+ safe_str_client(node_describe(exitnode)),
+ apconn->may_use_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