[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r18396: {tor} If we're using bridges and our network goes away, be more wi (in tor/trunk: . doc src/or)



Author: arma
Date: 2009-02-04 18:27:35 -0500 (Wed, 04 Feb 2009)
New Revision: 18396

Modified:
   tor/trunk/ChangeLog
   tor/trunk/doc/TODO.021
   tor/trunk/src/or/circuitbuild.c
   tor/trunk/src/or/circuituse.c
   tor/trunk/src/or/connection.c
   tor/trunk/src/or/connection_or.c
   tor/trunk/src/or/or.h
Log:
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.


Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog	2009-02-04 23:26:39 UTC (rev 18395)
+++ tor/trunk/ChangeLog	2009-02-04 23:27:35 UTC (rev 18396)
@@ -29,6 +29,9 @@
       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,

Modified: tor/trunk/doc/TODO.021
===================================================================
--- tor/trunk/doc/TODO.021	2009-02-04 23:26:39 UTC (rev 18395)
+++ tor/trunk/doc/TODO.021	2009-02-04 23:27:35 UTC (rev 18396)
@@ -126,7 +126,7 @@
     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:

Modified: tor/trunk/src/or/circuitbuild.c
===================================================================
--- tor/trunk/src/or/circuitbuild.c	2009-02-04 23:26:39 UTC (rev 18395)
+++ tor/trunk/src/or/circuitbuild.c	2009-02-04 23:27:35 UTC (rev 18396)
@@ -2260,10 +2260,15 @@
  * 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 @@
     }
   }
 
+  /* 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 @@
         }
       }
     });
+  log_debug(LD_DIR, "any_known %d, any_running %d", any_known, any_running);
   return any_known && !any_running;
 }
 

Modified: tor/trunk/src/or/circuituse.c
===================================================================
--- tor/trunk/src/or/circuituse.c	2009-02-04 23:26:39 UTC (rev 18395)
+++ tor/trunk/src/or/circuituse.c	2009-02-04 23:27:35 UTC (rev 18396)
@@ -812,7 +812,7 @@
       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);

Modified: tor/trunk/src/or/connection.c
===================================================================
--- tor/trunk/src/or/connection.c	2009-02-04 23:26:39 UTC (rev 18395)
+++ tor/trunk/src/or/connection.c	2009-02-04 23:27:35 UTC (rev 18396)
@@ -572,9 +572,8 @@
         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,

Modified: tor/trunk/src/or/connection_or.c
===================================================================
--- tor/trunk/src/or/connection_or.c	2009-02-04 23:26:39 UTC (rev 18395)
+++ tor/trunk/src/or/connection_or.c	2009-02-04 23:27:35 UTC (rev 18396)
@@ -783,11 +783,9 @@
       /* 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 @@
              "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 @@
   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

Modified: tor/trunk/src/or/or.h
===================================================================
--- tor/trunk/src/or/or.h	2009-02-04 23:26:39 UTC (rev 18395)
+++ tor/trunk/src/or/or.h	2009-02-04 23:27:35 UTC (rev 18396)
@@ -2741,7 +2741,7 @@
 
 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);