[tor-commits] [tor/master] choose_random_entry_impl(): Remove useless consider_exit_family.

nickm at torproject.org nickm at torproject.org
Wed Jul 16 13:34:43 UTC 2014


commit f75c6ce981a8e781c4c697d37094fe024f258b65
Author: George Kadianakis <desnacked at riseup.net>
Date:   Mon Jun 9 17:42:55 2014 +0100

    choose_random_entry_impl(): Remove useless consider_exit_family.
    
    The variable was useless since it was only toggled off in disabled code.
    
    If the 'exit_family' smartlist is empty, we don't consider exit family
    anyway.
---
 src/or/entrynodes.c |   18 +++---------------
 1 file changed, 3 insertions(+), 15 deletions(-)

diff --git a/src/or/entrynodes.c b/src/or/entrynodes.c
index f2709fb..e78f0c3 100644
--- a/src/or/entrynodes.c
+++ b/src/or/entrynodes.c
@@ -1008,7 +1008,7 @@ choose_random_entry_impl(cpath_build_state_t *state, int for_directory,
   const node_t *node = NULL;
   int need_uptime = state ? state->need_uptime : 0;
   int need_capacity = state ? state->need_capacity : 0;
-  int preferred_min, consider_exit_family = 0;
+  int preferred_min = 0;
   int need_descriptor = !for_directory;
   const int num_needed = decide_num_guards(options, for_directory);
 
@@ -1017,7 +1017,6 @@ choose_random_entry_impl(cpath_build_state_t *state, int for_directory,
 
   if (chosen_exit) {
     nodelist_add_node_and_family(exit_family, chosen_exit);
-    consider_exit_family = 1;
   }
 
   if (!entry_guards)
@@ -1044,7 +1043,7 @@ choose_random_entry_impl(cpath_build_state_t *state, int for_directory,
       }
       if (node == chosen_exit)
         continue; /* don't pick the same node for entry and exit */
-      if (consider_exit_family && smartlist_contains(exit_family, node))
+      if (smartlist_contains(exit_family, node))
         continue; /* avoid relays that are family members of our exit */
       if (dirinfo_type != NO_DIRINFO &&
           !node_can_handle_dirinfo(node, dirinfo_type))
@@ -1099,18 +1098,7 @@ choose_random_entry_impl(cpath_build_state_t *state, int for_directory,
       need_capacity = 0;
       goto retry;
     }
-#if 0
-    /* Removing this retry logic: if we only allow one exit, and it is in the
-       same family as all our entries, then we are just plain not going to win
-       here. */
-    if (!node && entry_list_is_constrained(options) && consider_exit_family) {
-      /* still no? if we're using bridges or have strictentrynodes
-       * set, and our chosen exit is in the same family as all our
-       * bridges/entry guards, then be flexible about families. */
-      consider_exit_family = 0;
-      goto retry;
-    }
-#endif
+
     /* live_entry_guards may be empty below. Oh well, we tried. */
   }
 





More information about the tor-commits mailing list