Merge remote-tracking branch 'origin/maint-0.2.4'

This commit is contained in:
Nick Mathewson
2013-07-31 21:49:30 -04:00
5 changed files with 25 additions and 8 deletions
+1 -1
View File
@@ -315,7 +315,7 @@ static config_var_t option_vars_[] = {
OBSOLETE("NoPublish"),
VAR("NodeFamily", LINELIST, NodeFamilies, NULL),
V(NumCPUs, UINT, "0"),
V(NumDirectoryGuards, UINT, "3"),
V(NumDirectoryGuards, UINT, "0"),
V(NumEntryGuards, UINT, "3"),
V(ORListenAddress, LINELIST, NULL),
VPORT(ORPort, LINELIST, NULL),
+13 -4
View File
@@ -419,14 +419,24 @@ add_an_entry_guard(const node_t *chosen, int reset_status, int prepend,
return node;
}
/** 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
decide_num_guards(const or_options_t *options, int for_directory)
{
if (for_directory && options->NumDirectoryGuards != 0)
return options->NumDirectoryGuards;
return options->NumEntryGuards;
}
/** If the use of entry guards is configured, choose more entry guards
* until we have enough in the list. */
static void
pick_entry_guards(const or_options_t *options, int for_directory)
{
int changed = 0;
const int num_needed = for_directory ? options->NumDirectoryGuards :
options->NumEntryGuards;
const int num_needed = decide_num_guards(options, for_directory);
tor_assert(entry_guards);
@@ -966,8 +976,7 @@ choose_random_entry_impl(cpath_build_state_t *state, int for_directory,
int need_capacity = state ? state->need_capacity : 0;
int preferred_min, consider_exit_family = 0;
int need_descriptor = !for_directory;
const int num_needed = for_directory ? options->NumDirectoryGuards :
options->NumEntryGuards;
const int num_needed = decide_num_guards(options, for_directory);
if (chosen_exit) {
nodelist_add_node_and_family(exit_family, chosen_exit);
+2 -1
View File
@@ -3784,7 +3784,8 @@ typedef struct {
int NumEntryGuards; /**< How many entry guards do we try to establish? */
int UseEntryGuardsAsDirGuards; /** Boolean: Do we try to get directory info
* from a smallish number of fixed nodes? */
int NumDirectoryGuards; /**< How many dir guards do we try to establish? */
int NumDirectoryGuards; /**< How many dir guards do we try to establish?
* If 0, use value from NumEntryGuards. */
int RephistTrackTime; /**< How many seconds do we keep rephist info? */
int FastFirstHopPK; /**< If Tor believes it is safe, should we save a third
* of our PK time by sending CREATE_FAST cells? */