]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
If we're using bridges and our network goes away, be more willing
authorRoger Dingledine <arma@torproject.org>
Wed, 4 Feb 2009 23:27:35 +0000 (23:27 +0000)
committerRoger Dingledine <arma@torproject.org>
Wed, 4 Feb 2009 23:27:35 +0000 (23:27 +0000)
to forgive our bridges and try again when we get an application
request. Bugfix on 0.2.0.x.

svn:r18396

ChangeLog
doc/TODO.021
src/or/circuitbuild.c
src/or/circuituse.c
src/or/connection.c
src/or/connection_or.c
src/or/or.h

index 84593ff0e3c46b897ba24f3cd30eb4a178cde60b..c5376527f000cfb42e4461876ce2909057344365 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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,
index 711187c0f45b9dbdb3e6120ec1c46a65f93a7fab..f44ebb01025b2ee621ae2b8ee68d4eacc883b93c 100644 (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:
index 0aeb7686ae98db08749856e54ea31a63049432e5..12db9dd7c5325170fadfcb5776e6f37cdc34b68f 100644 (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;
 }
 
index 06a083ef0f7feaa942034d30db2ee977af5fa98e..4bc6fcbe8faac9329b8d2314d77cf76532e9c530 100644 (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);
index 56b31ad8e16db30bd8bed17bce1173d03daa9bd3..3812dd8e3eb0640fe9c9807ad34205d7351141fd 100644 (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,
index 8ccc9b26341166cafcc87c6da829a89cb35e3e83..4e729ad6f27176f03c83d005de80caf76d0d5d3d 100644 (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
index b1561cbc4f458a8def1d8a91ee0125a9c574fa1f..d8122dbbc30f59f8541fc53bb2c59fd5acfca027 100644 (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);