diff options
author | Roger Dingledine <arma@torproject.org> | 2014-07-23 15:28:40 -0400 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2014-07-24 16:19:47 -0400 |
commit | 9fc276a1c7f94d1e0a48e00a358536027a9a7820 (patch) | |
tree | 81adbe624269b9bc40859b44dc6f341ff32c2990 /src | |
parent | 56ee61b8aed058c20edc9c7e10dc48f1ab798bbc (diff) | |
download | tor-9fc276a1c7f94d1e0a48e00a358536027a9a7820.tar.gz tor-9fc276a1c7f94d1e0a48e00a358536027a9a7820.zip |
add a NumDirectoryGuards consensus param too
Diffstat (limited to 'src')
-rw-r--r-- | src/or/entrynodes.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/or/entrynodes.c b/src/or/entrynodes.c index abd10e385e..484b88dbf8 100644 --- a/src/or/entrynodes.c +++ b/src/or/entrynodes.c @@ -433,10 +433,18 @@ add_an_entry_guard(const node_t *chosen, int reset_status, int prepend, static int decide_num_guards(const or_options_t *options, int for_directory) { - if (for_directory && options->NumDirectoryGuards != 0) - return options->NumDirectoryGuards; + 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); } |