[or-cvs] best_support_idx is obsolete

Roger Dingledine arma at seul.org
Tue Feb 17 08:42:27 UTC 2004


Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/home2/arma/work/onion/cvs/src/or

Modified Files:
	onion.c routerlist.c 
Log Message:
best_support_idx is obsolete
(also doesn't fix the bug)


Index: onion.c
===================================================================
RCS file: /home/or/cvsroot/src/or/onion.c,v
retrieving revision 1.124
retrieving revision 1.125
diff -u -d -r1.124 -r1.125
--- onion.c	17 Feb 2004 08:29:21 -0000	1.124
+++ onion.c	17 Feb 2004 08:42:25 -0000	1.125
@@ -222,7 +222,6 @@
   connection_t **carray;
   int n_connections;
   int best_support = -1;
-  int best_support_idx = -1;
   int n_best_support=0;
   smartlist_t *sl, *preferredexits, *excludedexits;
   routerinfo_t *router;
@@ -283,7 +282,7 @@
     if (n_supported[i] > best_support) {
       /* If this router is better than previous ones, remember its index
        * and goodness, and start counting how many routers are this good. */
-      best_support = n_supported[i]; best_support_idx = i; n_best_support=1;
+      best_support = n_supported[i]; n_best_support=1;
       log_fn(LOG_DEBUG,"%s is new best supported option so far.",
              dir->routers[i]->nickname);
     } else if (n_supported[i] == best_support) {
@@ -306,7 +305,7 @@
   /* If any routers definitely support any pending connections, choose one
    * at random. */
   if (best_support > 0) {
-    for (i = best_support_idx; i < dir->n_routers; i++)
+    for (i = 0; i < dir->n_routers; i++)
       if (n_supported[i] == best_support)
         smartlist_add(sl, dir->routers[i]);
 
@@ -320,7 +319,7 @@
     if (best_support == -1) {
       log(LOG_WARN, "All routers are down or middleman -- choosing a doomed exit at random.");
     }
-    for(i = best_support_idx; i < dir->n_routers; i++)
+    for(i = 0; i < dir->n_routers; i++)
       if(n_supported[i] != -1)
         smartlist_add(sl, dir->routers[i]);
 
@@ -336,10 +335,6 @@
   tor_free(n_supported);
   if(router) {
     log_fn(LOG_WARN, "Chose exit server '%s'", router->nickname);
-    if(router_exit_policy_rejects_all(router))
-      log_fn(LOG_WARN,"...which will reject all. Bug.");
-    if(!strcmp(router->nickname,"tor26") || !strcmp(router->nickname,"jap"))
-      log_fn(LOG_WARN,"...which is tor26 or jap, which should reject all.");
     return router;
   }
   log_fn(LOG_WARN, "No exit routers seem to be running; can't choose an exit.");

Index: routerlist.c
===================================================================
RCS file: /home/or/cvsroot/src/or/routerlist.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- routerlist.c	17 Feb 2004 08:10:07 -0000	1.23
+++ routerlist.c	17 Feb 2004 08:42:25 -0000	1.24
@@ -419,7 +419,7 @@
           /* The exit policy is reject ???:port */
           maybe_reject = 1;
         } else {
-          /* The exit policy is acccept ???:port */
+          /* The exit policy is accept ???:port */
           maybe_accept = 1;
         }
       }



More information about the tor-commits mailing list