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

[or-cvs] r8628: resolve the entryguard uptime/capacity question. and mark a (tor/trunk/src/or)



Author: arma
Date: 2006-10-06 22:55:44 -0400 (Fri, 06 Oct 2006)
New Revision: 8628

Modified:
   tor/trunk/src/or/circuitbuild.c
Log:
resolve the entryguard uptime/capacity question. and mark a
new xxx that we'll want to address one day.


Modified: tor/trunk/src/or/circuitbuild.c
===================================================================
--- tor/trunk/src/or/circuitbuild.c	2006-10-07 01:37:23 UTC (rev 8627)
+++ tor/trunk/src/or/circuitbuild.c	2006-10-07 02:55:44 UTC (rev 8628)
@@ -1842,6 +1842,8 @@
  * - Present in the routerlist;
  * - Listed as 'stable' or 'fast' by the current dirserver concensus,
  *   if demanded by <b>need_uptime</b> or <b>need_capacity</b>;
+ *   (This check is currently redundant with the Guard flag, but in
+ *   the future that might change. Best to leave it in for now.)
  * - Allowed by our current ReachableAddresses config option; and
  * - Currently thought to be reachable by us (unless assume_reachable
  *   is true).
@@ -1859,7 +1861,6 @@
   r = router_get_by_digest(e->identity);
   if (!r)
     return NULL;
-  /* Remove this check -- it seems redundant wrt the Guard flag? XXXX NM */
   if (router_is_unreliable(r, need_uptime, need_capacity, 0))
     return NULL;
   if (firewall_is_fascist_or() &&
@@ -2272,22 +2273,25 @@
    * using him.
    * (We might get 2 live-but-crummy entry guards, but so be it.) */
   if (smartlist_len(live_entry_guards) < 2) {
-    if (need_uptime) {
-      need_uptime = 0; /* try without that requirement */
-      goto retry;
-    }
     if (!options->StrictEntryNodes) {
       /* still no? try adding a new entry then */
+      /* XXX if guard doesn't imply fast and stable, then we need
+       * to tell add_an_entry_guard below what we want, or it might
+       * be a long time til we get it. -RD */
       r = add_an_entry_guard(NULL);
       if (r) {
         smartlist_add(live_entry_guards, r);
         entry_guards_changed();
       }
     }
+    if (!r && need_uptime) {
+      need_uptime = 0; /* try without that requirement */
+      goto retry;
+    }
     if (!r && need_capacity) {
-        /* still no? last attempt, try without requiring capacity */
-        need_capacity = 0;
-        goto retry;
+      /* still no? last attempt, try without requiring capacity */
+      need_capacity = 0;
+      goto retry;
     }
     /* live_entry_guards will be empty below. Oh well, we tried. */
   }