[or-cvs] what the heck is wrong with this little piece of code?

arma at seul.org arma at seul.org
Wed Dec 7 04:43:42 UTC 2005


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

Modified Files:
	circuitbuild.c connection_edge.c 
Log Message:
what the heck is wrong with this little piece of code?
why can none of us get it right?
it looks so simple.


Index: circuitbuild.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/circuitbuild.c,v
retrieving revision 1.166
retrieving revision 1.167
diff -u -d -r1.166 -r1.167
--- circuitbuild.c	3 Dec 2005 16:32:29 -0000	1.166
+++ circuitbuild.c	7 Dec 2005 04:43:39 -0000	1.167
@@ -1431,9 +1431,9 @@
 }
 
 /** Pick a good entry server for the circuit to be built according to
- * <b>state</b>.  Don't reuse a chosen exit (if any), don't use this router
- * (if we're an OR), and respect firewall settings; if we're using helper nodes,
- * return one.
+ * <b>state</b>.  Don't reuse a chosen exit (if any), don't use this
+ * router (if we're an OR), and respect firewall settings; if we're
+ * using helper nodes, return one.
  *
  * If <b>state</b> is NULL, we're choosing entries to serve as helper nodes,
  * not for any particular circuit.
@@ -1468,6 +1468,8 @@
         smartlist_add(excluded, r);
     }
   }
+  // XXX we should exclude busy exit nodes here, too,
+  // but only if there are enough other nodes available.
   choice = router_choose_random_node(options->EntryNodes, options->ExcludeNodes,
            excluded, state ? state->need_uptime : 1,
            state ? state->need_capacity : 0,

Index: connection_edge.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/connection_edge.c,v
retrieving revision 1.373
retrieving revision 1.374
diff -u -d -r1.373 -r1.374
--- connection_edge.c	6 Dec 2005 23:43:52 -0000	1.373
+++ connection_edge.c	7 Dec 2005 04:43:39 -0000	1.374
@@ -1005,8 +1005,9 @@
       }
     } else {
       struct in_addr in;
-      routerinfo_t *r = router_get_by_nickname(conn->chosen_exit_name, 1);
+      routerinfo_t *r;
       conn->chosen_exit_name = tor_strdup(socks->address);
+      r = router_get_by_nickname(conn->chosen_exit_name, 1);
       *socks->address = 0;
       if (r) {
         /* XXXX Should this use server->address instead? */



More information about the tor-commits mailing list