]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Merge branch 'maint-0.2.5'
authorRoger Dingledine <arma@torproject.org>
Thu, 24 Jul 2014 20:23:26 +0000 (16:23 -0400)
committerRoger Dingledine <arma@torproject.org>
Thu, 24 Jul 2014 20:23:26 +0000 (16:23 -0400)
1  2 
doc/tor.1.txt
src/or/config.c
src/or/entrynodes.c

diff --cc doc/tor.1.txt
Simple merge
diff --cc src/or/config.c
Simple merge
index 4d091957963e4b19b4dcb80b55836bad40d5e169,66b720118797fc40bf7a882a58c97337a4b35040..365b9274ecd2b0dce0510e5329eedf7b2696dff3
@@@ -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