diff options
author | Roger Dingledine <arma@torproject.org> | 2008-03-24 19:14:48 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2008-03-24 19:14:48 +0000 |
commit | 981ad6021d16ac580ab638afc46956dc50c12a7c (patch) | |
tree | e8d4c8c42488700252c7b7183edf2d9d15027bb3 | |
parent | ef551d7d263d6dcc569c647e7b2bd5385b11dded (diff) | |
download | tor-981ad6021d16ac580ab638afc46956dc50c12a7c.tar.gz tor-981ad6021d16ac580ab638afc46956dc50c12a7c.zip |
backport r14162-r14164
svn:r14167
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | src/or/circuituse.c | 12 | ||||
-rw-r--r-- | src/or/connection_edge.c | 26 | ||||
-rw-r--r-- | src/or/or.h | 1 |
4 files changed, 46 insertions, 1 deletions
@@ -1,3 +1,11 @@ +Changes in version 0.2.0.23-rc - 2008-03-2? + o Major bugfixes: + - When a tunneled directory request is made to a directory server + that's down, notice after 30 seconds rather than 120 seconds. Also, + fail any begindir streams that are pending on it, so they can + retry elsewhere. This was causing multi-minute delays on bootstrap. + + Changes in version 0.2.0.22-rc - 2008-03-18 o Major features: - Enable encrypted directory connections by default for non-relays, diff --git a/src/or/circuituse.c b/src/or/circuituse.c index 5f45292859..ffe18c05a0 100644 --- a/src/or/circuituse.c +++ b/src/or/circuituse.c @@ -210,15 +210,22 @@ circuit_expire_building(time_t now) { circuit_t *victim, *circ = global_circuitlist; time_t cutoff = now - get_options()->CircuitBuildTimeout; + time_t begindir_cutoff = now - get_options()->CircuitBuildTimeout/2; + cpath_build_state_t *build_state; while (circ) { victim = circ; circ = circ->next; if (!CIRCUIT_IS_ORIGIN(victim) || /* didn't originate here */ - victim->timestamp_created > cutoff || /* Not old enough to expire */ victim->marked_for_close) /* don't mess with marked circs */ continue; + build_state = TO_ORIGIN_CIRCUIT(victim)->build_state; + if (victim->timestamp_created > + ((build_state && build_state->onehop_tunnel) ? + begindir_cutoff : cutoff)) + continue; /* it's still young, leave it alone */ + #if 0 /* some debug logs, to help track bugs */ if (victim->purpose >= CIRCUIT_PURPOSE_C_INTRODUCING && @@ -738,6 +745,9 @@ circuit_build_failed(origin_circuit_t *circ) n_conn->_base.or_is_obsolete = 1; entry_guard_register_connect_status(n_conn->identity_digest, 0, time(NULL)); + /* if there are any one-hop streams waiting on this circuit, fail + * them now so they can retry elsewhere. */ + connection_ap_fail_onehop(n_conn->identity_digest); } } diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c index ee60dbff5a..baf344b99b 100644 --- a/src/or/connection_edge.c +++ b/src/or/connection_edge.c @@ -457,6 +457,32 @@ connection_ap_attach_pending(void) }); } +/** Tell any AP streams that are waiting for a onehop tunnel to + * <b>failed_digest</b> that they are going to fail. */ +void +connection_ap_fail_onehop(const char *failed_digest) +{ + edge_connection_t *edge_conn; + char digest[DIGEST_LEN]; + smartlist_t *conns = get_connection_array(); + SMARTLIST_FOREACH(conns, connection_t *, conn, + { + if (conn->marked_for_close || + conn->type != CONN_TYPE_AP || + conn->state != AP_CONN_STATE_CIRCUIT_WAIT) + continue; + edge_conn = TO_EDGE_CONN(conn); + if (!edge_conn->want_onehop) + continue; + if (!hexdigest_to_digest(edge_conn->chosen_exit_name, digest) && + !memcmp(digest, failed_digest, DIGEST_LEN)) { + log_info(LD_APP, "Closing onehop stream to '%s' because the OR conn " + "just failed.", edge_conn->chosen_exit_name); + connection_mark_unattached_ap(edge_conn, END_STREAM_REASON_TIMEOUT); + } + }); +} + /** 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. diff --git a/src/or/or.h b/src/or/or.h index d4b8e5d3e5..9c91a55fe9 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -2801,6 +2801,7 @@ int connection_edge_is_rendezvous_stream(edge_connection_t *conn); int connection_ap_can_use_exit(edge_connection_t *conn, routerinfo_t *exit); void connection_ap_expire_beginning(void); void connection_ap_attach_pending(void); +void connection_ap_fail_onehop(const char *failed_digest); void circuit_discard_optional_exit_enclaves(extend_info_t *info); int connection_ap_detach_retriable(edge_connection_t *conn, origin_circuit_t *circ, |