commit bc9866e13ff140b237b0560a784bb72bff67a8e3 Merge: dfe80c9 a4c641c Author: Roger Dingledine arma@torproject.org Date: Thu Jul 24 16:23:26 2014 -0400
Merge branch 'maint-0.2.5'
changes/ticket12688 | 6 ++++++ doc/tor.1.txt | 8 ++++++-- src/or/config.c | 5 +---- src/or/entrynodes.c | 20 ++++++++++++++++---- 4 files changed, 29 insertions(+), 10 deletions(-)
diff --cc src/or/entrynodes.c index 4d09195,66b7201..365b927 --- a/src/or/entrynodes.c +++ b/src/or/entrynodes.c @@@ -450,12 -437,23 +450,23 @@@ add_an_entry_guard(const node_t *chosen /** Choose how many entry guards or directory guards we'll use. If * <b>for_directory</b> is true, we return how many directory guards to * use; else we return how many entry guards to use. */ -static int +STATIC int decide_num_guards(const or_options_t *options, int for_directory) { - if (for_directory && options->NumDirectoryGuards != 0) - return options->NumDirectoryGuards; - return options->NumEntryGuards; + if (for_directory) { + int answer; + if (options->NumDirectoryGuards != 0) + return options->NumDirectoryGuards; + answer = networkstatus_get_param(NULL, "NumDirectoryGuards", 0, 0, 10); + if (answer) /* non-zero means use the consensus value */ + return answer; + } + + if (options->NumEntryGuards) + return options->NumEntryGuards; + + /* Use the value from the consensus, or 3 if no guidance. */ + return networkstatus_get_param(NULL, "NumEntryGuards", 3, 1, 10); }
/** If the use of entry guards is configured, choose more entry guards
tor-commits@lists.torproject.org