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

[or-cvs] r16984: {tor} Make sure ExcludeSingleHopRelays works for an exit. (tor/trunk/src/or)



Author: nickm
Date: 2008-09-26 15:09:12 -0400 (Fri, 26 Sep 2008)
New Revision: 16984

Modified:
   tor/trunk/src/or/circuitbuild.c
Log:
Make sure ExcludeSingleHopRelays works for an exit.

Modified: tor/trunk/src/or/circuitbuild.c
===================================================================
--- tor/trunk/src/or/circuitbuild.c	2008-09-26 18:58:45 UTC (rev 16983)
+++ tor/trunk/src/or/circuitbuild.c	2008-09-26 19:09:12 UTC (rev 16984)
@@ -1197,8 +1197,6 @@
 
   connections = get_connection_array();
 
-  /* XXXX021 Respect ExcludeSingleHopRelays here. */
-
   /* Count how many connections are waiting for a circuit to be built.
    * We use this for log messages now, but in the future we may depend on it.
    */
@@ -1213,6 +1211,8 @@
    * of the pending connections could possibly exit from that
    * router (n_supported[i]). (We can't be sure about cases where we
    * don't know the IP address of the pending connection.)
+   *
+   * -1 means "Don't use this router at all."
    */
   n_supported = tor_malloc(sizeof(int)*smartlist_len(dir->routers));
   for (i = 0; i < smartlist_len(dir->routers); ++i) {/* iterate over routers */
@@ -1240,6 +1240,10 @@
 //             router->nickname, i);
       continue; /* skip invalid routers */
     }
+    if (options->ExcludeSingleHopRelays && router->allow_single_hop_exits) {
+      n_supported[i] = -1;
+      continue;
+    }
     if (router_exit_policy_rejects_all(router)) {
       n_supported[i] = -1;
 //      log_fn(LOG_DEBUG,"Skipping node %s (index %d) -- it rejects all.",
@@ -2460,8 +2464,6 @@
     consider_exit_family = 1;
   }
 
-  /* XXXX021 Respect ExcludeSingleHopRelays here. */
-
   if (!entry_guards)
     entry_guards = smartlist_create();