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

[or-cvs] strictentrynodes means we should clear the current entry_no...



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

Modified Files:
	circuitbuild.c 
Log Message:
strictentrynodes means we should clear the current entry_nodes list.


Index: circuitbuild.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/circuitbuild.c,v
retrieving revision 1.199
retrieving revision 1.200
diff -u -p -d -r1.199 -r1.200
--- circuitbuild.c	31 Dec 2005 06:37:34 -0000	1.199
+++ circuitbuild.c	2 Jan 2006 11:33:14 -0000	1.200
@@ -2065,23 +2065,29 @@ entry_nodes_prepend_from_config(void)
   int idx;
   or_options_t *options = get_options();
   smartlist_t *routers = smartlist_create();
+  smartlist_t *tmp = smartlist_create();
 
   tor_assert(entry_nodes);
+  tor_assert(options->EntryNodes);
+
+  if (options->StrictEntryNodes) {
+    info(LD_CIRC,"Clearing old entry nodes");
+    SMARTLIST_FOREACH(entry_nodes, entry_node_t *, e, tor_free(e));
+    smartlist_clear(entry_nodes);
+    entry_nodes_changed();
+  }
 
   add_nickname_list_to_smartlist(routers, options->EntryNodes,
                                  0, 1, 1);
 
   /* take a moment first to notice whether we got them all */
-  if (options->EntryNodes) {
-    notice(LD_CIRC,"Adding configured EntryNodes '%s'.",
-           options->EntryNodes);
-    smartlist_t *tmp = smartlist_create();
-    smartlist_split_string(tmp, options->EntryNodes, ",",
-                           SPLIT_SKIP_SPACE|SPLIT_IGNORE_BLANK, 0);
-    missed_some = smartlist_len(routers) != smartlist_len(tmp);
-    SMARTLIST_FOREACH(tmp, char *, nick, tor_free(nick));
-    smartlist_free(tmp);
-  }
+  notice(LD_CIRC,"Adding configured EntryNodes '%s'.",
+         options->EntryNodes);
+  smartlist_split_string(tmp, options->EntryNodes, ",",
+                         SPLIT_SKIP_SPACE|SPLIT_IGNORE_BLANK, 0);
+  missed_some = smartlist_len(routers) != smartlist_len(tmp);
+  SMARTLIST_FOREACH(tmp, char *, nick, tor_free(nick));
+  smartlist_free(tmp);
 
   for (idx = smartlist_len(routers)-1 ; idx >= 0; idx--) {
     /* pick off the last one, turn it into a router, prepend it
@@ -2115,10 +2121,10 @@ choose_random_entry(cpath_build_state_t 
   if (should_add_entry_nodes)
     entry_nodes_prepend_from_config();
 
-  if (! entry_nodes ||
-      smartlist_len(entry_nodes) < options->NumEntryNodes)
-    if (!options->StrictEntryNodes)
-      pick_entry_nodes();
+  if (!options->StrictEntryNodes &&
+      (! entry_nodes ||
+       smartlist_len(entry_nodes) < options->NumEntryNodes))
+    pick_entry_nodes();
 
  retry:
   smartlist_clear(live_entry_nodes);