Merge remote-tracking branch 'arma/feature13153'

This commit is contained in:
Nick Mathewson 2014-09-22 10:42:54 -04:00
commit d3382297fe
4 changed files with 21 additions and 23 deletions

5
changes/feature13153 Normal file
View file

@ -0,0 +1,5 @@
o Code simplication:
- Clients are now willing to send optimistic circuit data (before they
receive a 'connected' cell) to relays of any version. We used to
only do it for relays running 0.2.3.1-alpha or later, but now all
relays are new enough. Resolves ticket 13153.

View file

@ -2070,7 +2070,7 @@ static void
link_apconn_to_circ(entry_connection_t *apconn, origin_circuit_t *circ, link_apconn_to_circ(entry_connection_t *apconn, origin_circuit_t *circ,
crypt_path_t *cpath) crypt_path_t *cpath)
{ {
const node_t *exitnode; const node_t *exitnode = NULL;
/* add it into the linked list of streams on this circuit */ /* 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.", log_debug(LD_APP|LD_CIRC, "attaching new conn to circ. n_circ_id %u.",
@ -2104,23 +2104,22 @@ link_apconn_to_circ(entry_connection_t *apconn, origin_circuit_t *circ,
circ->isolation_any_streams_attached = 1; circ->isolation_any_streams_attached = 1;
connection_edge_update_circuit_isolation(apconn, circ, 0); 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 */ /* See if we can use optimistic data on this circuit */
if (cpath->extend_info && if (optimistic_data_enabled() &&
(exitnode = node_get_by_id(cpath->extend_info->identity_digest)) && circ->base_.purpose == CIRCUIT_PURPOSE_C_GENERAL)
exitnode->rs) { apconn->may_use_optimistic_data = 1;
/* Okay; we know what exit node this is. */ else
if (optimistic_data_enabled() && apconn->may_use_optimistic_data = 0;
circ->base_.purpose == CIRCUIT_PURPOSE_C_GENERAL && log_info(LD_APP, "Looks like completed circuit to %s %s allow "
exitnode->rs->version_supports_optimistic_data) "optimistic data for connection to %s",
apconn->may_use_optimistic_data = 1; /* node_describe() does the right thing if exitnode is NULL */
else safe_str_client(node_describe(exitnode)),
apconn->may_use_optimistic_data = 0; apconn->may_use_optimistic_data ? "does" : "doesn't",
log_info(LD_APP, "Looks like completed circuit to %s %s allow " safe_str_client(apconn->socks_request->address));
"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));
}
} }
/** Return true iff <b>address</b> is matched by one of the entries in /** Return true iff <b>address</b> is matched by one of the entries in

View file

@ -2149,9 +2149,6 @@ typedef struct routerstatus_t {
/** True iff this router is a version that, if it caches directory info, /** True iff this router is a version that, if it caches directory info,
* we can get microdescriptors from. */ * we can get microdescriptors from. */
unsigned int version_supports_microdesc_cache:1; unsigned int version_supports_microdesc_cache:1;
/** True iff this router is a version that allows DATA cells to arrive on
* a stream before it has sent a CONNECTED cell. */
unsigned int version_supports_optimistic_data:1;
/** True iff this router has a version that allows it to accept EXTEND2 /** True iff this router has a version that allows it to accept EXTEND2
* cells */ * cells */
unsigned int version_supports_extend2_cells:1; unsigned int version_supports_extend2_cells:1;

View file

@ -1916,12 +1916,9 @@ routerstatus_parse_entry_from_string(memarea_t *area,
rs->version_known = 1; rs->version_known = 1;
if (strcmpstart(tok->args[0], "Tor ")) { if (strcmpstart(tok->args[0], "Tor ")) {
rs->version_supports_microdesc_cache = 1; rs->version_supports_microdesc_cache = 1;
rs->version_supports_optimistic_data = 1;
} else { } else {
rs->version_supports_microdesc_cache = rs->version_supports_microdesc_cache =
tor_version_supports_microdescriptors(tok->args[0]); tor_version_supports_microdescriptors(tok->args[0]);
rs->version_supports_optimistic_data =
tor_version_as_new_as(tok->args[0], "0.2.3.1-alpha");
rs->version_supports_extend2_cells = rs->version_supports_extend2_cells =
tor_version_as_new_as(tok->args[0], "0.2.4.8-alpha"); tor_version_as_new_as(tok->args[0], "0.2.4.8-alpha");
} }