diff options
author | Roger Dingledine <arma@torproject.org> | 2009-02-04 23:27:35 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2009-02-04 23:27:35 +0000 |
commit | decdf4537ab9d2fc8301a01f7b7ce1b47b109f98 (patch) | |
tree | cc250ef7b1e3a01d49d0f072cca05691ba2b1064 | |
parent | 8977f24eb8810d68c8fed09f5e81a0b0e0350a23 (diff) | |
download | tor-decdf4537ab9d2fc8301a01f7b7ce1b47b109f98.tar.gz tor-decdf4537ab9d2fc8301a01f7b7ce1b47b109f98.zip |
If we're using bridges and our network goes away, be more willing
to forgive our bridges and try again when we get an application
request. Bugfix on 0.2.0.x.
svn:r18396
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | doc/TODO.021 | 2 | ||||
-rw-r--r-- | src/or/circuitbuild.c | 13 | ||||
-rw-r--r-- | src/or/circuituse.c | 2 | ||||
-rw-r--r-- | src/or/connection.c | 5 | ||||
-rw-r--r-- | src/or/connection_or.c | 14 | ||||
-rw-r--r-- | src/or/or.h | 2 |
7 files changed, 26 insertions, 15 deletions
@@ -29,6 +29,9 @@ Changes in version 0.2.1.12-alpha - 2009-02-?? probe. Fixes bug 526. Bugfix on 0.1.2.1-alpha. - Support changing value of ServerDNSRandomizeCase during SIGHUP. Bugfix on 0.2.1.7-alpha. + - If we're using bridges and our network goes away, be more willing + to forgive our bridges and try again when we get an application + request. Bugfix on 0.2.0.x. o Minor features: - Support platforms where time_t is 64 bits long. (Congratulations, diff --git a/doc/TODO.021 b/doc/TODO.021 index 711187c0f4..f44ebb0102 100644 --- a/doc/TODO.021 +++ b/doc/TODO.021 @@ -126,7 +126,7 @@ R d bug: if we launch using bridges, and then stop using bridges, we so vidalia can say "recent activity (1-8 users) from sa". R - investigate: it looks like if the bridge authority is unreachable, we're not falling back on querying bridges directly? -R - if "no running bridges known", an application request should make + o if "no running bridges known", an application request should make us retry all our bridges. For 0.2.1.x: diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c index 0aeb7686ae..12db9dd7c5 100644 --- a/src/or/circuitbuild.c +++ b/src/or/circuitbuild.c @@ -2260,10 +2260,15 @@ entry_guards_compute_status(void) * is established (<b>succeeded</b>==1) or has failed (<b>succeeded</b>==0). * If the OR is an entry, change that entry's up/down status. * Return 0 normally, or -1 if we want to tear down the new connection. + * + * If <b>mark_relay_status</b>, also call router_set_status() on this + * relay. + * + * XXX022 change succeeded and mark_relay_status into 'int flags'. */ int entry_guard_register_connect_status(const char *digest, int succeeded, - time_t now) + int mark_relay_status, time_t now) { int changed = 0; int refuse_conn = 0; @@ -2333,6 +2338,11 @@ entry_guard_register_connect_status(const char *digest, int succeeded, } } + /* if the caller asked us to, also update the is_running flags for this + * relay */ + if (mark_relay_status) + router_set_status(digest, succeeded); + if (first_contact) { /* We've just added a new long-term entry guard. Perhaps the network just * came back? We should give our earlier entries another try too, @@ -3139,6 +3149,7 @@ bridges_retry_helper(int act) } } }); + log_debug(LD_DIR, "any_known %d, any_running %d", any_known, any_running); return any_known && !any_running; } diff --git a/src/or/circuituse.c b/src/or/circuituse.c index 06a083ef0f..4bc6fcbe8f 100644 --- a/src/or/circuituse.c +++ b/src/or/circuituse.c @@ -812,7 +812,7 @@ circuit_build_failed(origin_circuit_t *circ) n_conn->is_bad_for_new_circs = 1; } if (n_conn_id) { - entry_guard_register_connect_status(n_conn_id, 0, time(NULL)); + entry_guard_register_connect_status(n_conn_id, 0, 1, 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_id, circ->build_state); diff --git a/src/or/connection.c b/src/or/connection.c index 56b31ad8e1..3812dd8e3e 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -572,9 +572,8 @@ connection_about_to_close_connection(connection_t *conn) if (connection_or_nonopen_was_started_here(or_conn)) { or_options_t *options = get_options(); rep_hist_note_connect_failed(or_conn->identity_digest, now); - entry_guard_register_connect_status(or_conn->identity_digest,0,now); - if (!options->HttpsProxy) - router_set_status(or_conn->identity_digest, 0); + entry_guard_register_connect_status(or_conn->identity_digest,0, + !options->HttpsProxy, now); if (conn->state >= OR_CONN_STATE_TLS_HANDSHAKING) { int reason = tls_error_to_orconn_end_reason(or_conn->tls_error); control_event_or_conn_status(or_conn, OR_CONN_EVENT_FAILED, diff --git a/src/or/connection_or.c b/src/or/connection_or.c index 8ccc9b2634..4e729ad6f2 100644 --- a/src/or/connection_or.c +++ b/src/or/connection_or.c @@ -783,11 +783,9 @@ connection_or_connect(const tor_addr_t *_addr, uint16_t port, /* If the connection failed immediately, and we're using * an https proxy, our https proxy is down. Don't blame the * Tor server. */ - if (!options->HttpsProxy) { - entry_guard_register_connect_status(conn->identity_digest, 0, - time(NULL)); - router_set_status(conn->identity_digest, 0); - } + if (!options->HttpsProxy) + entry_guard_register_connect_status(conn->identity_digest, + 0, 1, time(NULL)); connection_or_connect_failed(conn, errno_to_orconn_end_reason(socket_error), tor_socket_strerror(socket_error)); @@ -1036,8 +1034,8 @@ connection_or_check_valid_tls_handshake(or_connection_t *conn, "Tried connecting to router at %s:%d, but identity key was not " "as expected: wanted %s but got %s.", conn->_base.address, conn->_base.port, expected, seen); - entry_guard_register_connect_status(conn->identity_digest,0,time(NULL)); - router_set_status(conn->identity_digest, 0); + entry_guard_register_connect_status(conn->identity_digest, 0, 1, + time(NULL)); control_event_or_conn_status(conn, OR_CONN_EVENT_FAILED, END_OR_CONN_REASON_OR_IDENTITY); if (!authdir_mode_tests_reachability(options)) @@ -1136,7 +1134,7 @@ connection_or_set_state_open(or_connection_t *conn) if (started_here) { rep_hist_note_connect_succeeded(conn->identity_digest, now); if (entry_guard_register_connect_status(conn->identity_digest, - 1, now) < 0) { + 1, 0, now) < 0) { /* Close any circuits pending on this conn. We leave it in state * 'open' though, because it didn't actually *fail* -- we just * chose not to use it. (Otherwise diff --git a/src/or/or.h b/src/or/or.h index b1561cbc4f..d8122dbbc3 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -2741,7 +2741,7 @@ const char *build_state_get_exit_nickname(cpath_build_state_t *state); void entry_guards_compute_status(void); int entry_guard_register_connect_status(const char *digest, int succeeded, - time_t now); + int mark_relay_status, time_t now); void entry_nodes_should_be_added(void); int entry_list_can_grow(or_options_t *options); routerinfo_t *choose_random_entry(cpath_build_state_t *state); |