aboutsummaryrefslogtreecommitdiff
path: root/src/or/circuitbuild.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2006-01-02 11:33:14 +0000
committerRoger Dingledine <arma@torproject.org>2006-01-02 11:33:14 +0000
commit1d474e14d7e12cc3e504f7e6d88563132d3201b7 (patch)
tree544fc91c1e0b8e47f692cc3f5eb93279bcf92700 /src/or/circuitbuild.c
parentc5a5161fb5d7a71c477b857db6f206bd2d560e5c (diff)
downloadtor-1d474e14d7e12cc3e504f7e6d88563132d3201b7.tar
tor-1d474e14d7e12cc3e504f7e6d88563132d3201b7.tar.gz
strictentrynodes means we should clear the current entry_nodes list.
svn:r5703
Diffstat (limited to 'src/or/circuitbuild.c')
-rw-r--r--src/or/circuitbuild.c34
1 files changed, 20 insertions, 14 deletions
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index 32eb87892..bfe61ff87 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -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 *state)
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);