summaryrefslogtreecommitdiff
path: root/src/or/entrynodes.c
diff options
context:
space:
mode:
authorGeorge Kadianakis <desnacked@riseup.net>2016-06-07 17:22:47 +0300
committerGeorge Kadianakis <desnacked@riseup.net>2016-06-07 17:22:47 +0300
commit36dd9538d9163f2489fa45e546389d0a262c8c9c (patch)
treef26a44100b070837f8277a1d0671010a91b6ec3b /src/or/entrynodes.c
parent9c7edb0f3edd2dec30f10e195f7bcc12a4005f30 (diff)
downloadtor-36dd9538d9163f2489fa45e546389d0a262c8c9c.tar.gz
tor-36dd9538d9163f2489fa45e546389d0a262c8c9c.zip
Don't rely on consensus parameter to use a single guard.
Diffstat (limited to 'src/or/entrynodes.c')
-rw-r--r--src/or/entrynodes.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/or/entrynodes.c b/src/or/entrynodes.c
index 310a948b35..93300e7c73 100644
--- a/src/or/entrynodes.c
+++ b/src/or/entrynodes.c
@@ -76,6 +76,14 @@ static const node_t *choose_random_entry_impl(cpath_build_state_t *state,
int *n_options_out);
static int num_bridges_usable(void);
+/* Default number of entry guards in the case where the NumEntryGuards
+ * consensus parameter is not set */
+#define DEFAULT_N_GUARDS 1
+/* Minimum and maximum number of entry guards (in case the NumEntryGuards
+ * consensus parameter is set). */
+#define MIN_N_GUARDS 1
+#define MAX_N_GUARDS 10
+
/** Return the list of entry guards, creating it if necessary. */
const smartlist_t *
get_entry_guards(void)
@@ -488,7 +496,8 @@ decide_num_guards(const or_options_t *options, int for_directory)
return options->NumEntryGuards;
/* Use the value from the consensus, or 3 if no guidance. */
- return networkstatus_get_param(NULL, "NumEntryGuards", 3, 1, 10);
+ return networkstatus_get_param(NULL, "NumEntryGuards", DEFAULT_N_GUARDS,
+ MIN_N_GUARDS, MAX_N_GUARDS);
}
/** If the use of entry guards is configured, choose more entry guards