diff options
author | Mike Perry <mikeperry-git@fscked.org> | 2012-12-08 16:37:22 -0800 |
---|---|---|
committer | Mike Perry <mikeperry-git@fscked.org> | 2012-12-08 16:37:22 -0800 |
commit | 686fc222593fd46ec82d62f0fa62ca02900c1014 (patch) | |
tree | e7bcb41cb31078acb8c127f8006216e4a9cddea4 /src | |
parent | b599a6ed07fd588500a256ef815e87729449626a (diff) | |
download | tor-686fc222593fd46ec82d62f0fa62ca02900c1014.tar tor-686fc222593fd46ec82d62f0fa62ca02900c1014.tar.gz |
Allow any valid 'end' cell to mean a circuit was used successfully.
Also improve some log messages.
Diffstat (limited to 'src')
-rw-r--r-- | src/or/circuitbuild.c | 9 | ||||
-rw-r--r-- | src/or/connection_edge.c | 17 | ||||
-rw-r--r-- | src/or/relay.c | 8 |
3 files changed, 25 insertions, 9 deletions
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c index 9b1236f34..c3a582758 100644 --- a/src/or/circuitbuild.c +++ b/src/or/circuitbuild.c @@ -1411,16 +1411,18 @@ pathbias_check_close(origin_circuit_t *ocirc, int reason) // state.. Can we use that? Does optimistic data change this? log_info(LD_CIRC, - "Circuit closed without successful use for reason %d. " + "Circuit %d closed without successful use for reason %d. " "Circuit purpose %d currently %s.", + ocirc->global_identifier, reason, circ->purpose, circuit_state_to_string(circ->state)); pathbias_count_unusable(ocirc); } else { if (reason & END_CIRC_REASON_FLAG_REMOTE) { /* Unused remote circ close reasons all could be bias */ log_info(LD_CIRC, - "Circuit remote-closed without successful use for reason %d. " + "Circuit %d remote-closed without successful use for reason %d. " "Circuit purpose %d currently %s.", + ocirc->global_identifier, reason, circ->purpose, circuit_state_to_string(circ->state)); pathbias_count_collapse(ocirc); } else if ((reason & ~END_CIRC_REASON_FLAG_REMOTE) @@ -1432,8 +1434,9 @@ pathbias_check_close(origin_circuit_t *ocirc, int reason) /* FIXME: Only count bias if the network is live? * What about clock jumps/suspends? */ log_info(LD_CIRC, - "Circuit's channel closed without successful use for reason %d, " + "Circuit %d's channel closed without successful use for reason %d, " "channel reason %d. Circuit purpose %d currently %s.", + ocirc->global_identifier, reason, circ->n_chan->reason_for_closing, circ->purpose, circuit_state_to_string(circ->state)); pathbias_count_collapse(ocirc); diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c index 79bb54cbb..ca6060ca5 100644 --- a/src/or/connection_edge.c +++ b/src/or/connection_edge.c @@ -2178,14 +2178,19 @@ connection_ap_handshake_socks_reply(entry_connection_t *conn, char *reply, /* Flag this stream's circuit as having completed a stream successfully * (for path bias) */ - if (status == SOCKS5_SUCCEEDED) { + if (status == SOCKS5_SUCCEEDED || + endreason == END_STREAM_REASON_RESOLVEFAILED || + endreason == END_STREAM_REASON_CONNECTREFUSED || + endreason == END_STREAM_REASON_CONNRESET || + endreason == END_STREAM_REASON_NOROUTE || + endreason == END_STREAM_REASON_RESOURCELIMIT) { if(!conn->edge_.on_circuit || !CIRCUIT_IS_ORIGIN(conn->edge_.on_circuit)) { - // XXX: Weird. We hit this a lot, and yet have no unusable_circs. - // Maybe during addrmaps/resolves? - log_warn(LD_BUG, - "(Harmless.) No origin circuit for successful SOCKS stream. " - "Reason: %d", endreason); + // DNS remaps can trigger this. So can failed hidden service + // lookups. + log_info(LD_BUG, + "(Harmless.) No origin circuit for successful SOCKS stream %ld. " + "Reason: %d", ENTRY_TO_CONN(conn)->global_identifier, endreason); } else { TO_ORIGIN_CIRCUIT(conn->edge_.on_circuit)->path_state = PATH_STATE_USE_SUCCEEDED; diff --git a/src/or/relay.c b/src/or/relay.c index 7f49299e2..1638dae4f 100644 --- a/src/or/relay.c +++ b/src/or/relay.c @@ -693,6 +693,14 @@ connection_ap_process_end_not_open( edge_connection_t *edge_conn = ENTRY_TO_EDGE_CONN(conn); (void) layer_hint; /* unused */ + if (rh->length > 0) { + /* Path bias: If we get a valid reason code from the exit, + * it wasn't due to tagging */ + // XXX: This relies on recognized+digest being strong enough not + // to be spoofable.. Is that a valid assumption? + circ->path_state = PATH_STATE_USE_SUCCEEDED; + } + if (rh->length > 0 && edge_reason_is_retriable(reason) && /* avoid retry if rend */ !connection_edge_is_rendezvous_stream(edge_conn)) { |