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
This commit is contained in:
Roger Dingledine 2009-02-04 23:27:35 +00:00
parent 8977f24eb8
commit decdf4537a
7 changed files with 26 additions and 15 deletions

View File

@ -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,

View File

@ -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:

View File

@ -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;
}

View File

@ -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);

View File

@ -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,

View File

@ -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

View File

@ -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);