commit bf263a9b99c41becc62ebe967124931330ae4016 Author: George Kadianakis desnacked@riseup.net Date: Sun Jun 15 18:38:52 2014 -0700
Make a few entrynodes.c functions testable. --- src/or/entrynodes.c | 10 ++++++---- src/or/entrynodes.h | 16 ++++++++++++++++ 2 files changed, 22 insertions(+), 4 deletions(-)
diff --git a/src/or/entrynodes.c b/src/or/entrynodes.c index d732791..360c738 100644 --- a/src/or/entrynodes.c +++ b/src/or/entrynodes.c @@ -12,6 +12,8 @@ * circumvention). **/
+#define ENTRYNODES_PRIVATE + #include "or.h" #include "circpathbias.h" #include "circuitbuild.h" @@ -350,7 +352,7 @@ control_event_guard_deferred(void) * If <b>chosen</b> is defined, use that one, and if it's not * already in our entry_guards list, put it at the *beginning*. * Else, put the one we pick at the end of the list. */ -static const node_t * +STATIC const node_t * add_an_entry_guard(const node_t *chosen, int reset_status, int prepend, int for_discovery, int for_directory) { @@ -437,7 +439,7 @@ add_an_entry_guard(const node_t *chosen, int reset_status, int prepend, /** 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) @@ -836,7 +838,7 @@ update_node_guard_status(void)
/** Adjust the entry guards list so that it only contains entries from * EntryNodes, adding new entries from EntryNodes to the list as needed. */ -static void +STATIC void entry_guards_set_from_config(const or_options_t *options) { smartlist_t *entry_nodes, *worse_entry_nodes, *entry_fps; @@ -997,7 +999,7 @@ choose_random_dirguard(dirinfo_type_t type)
/* DOCDOCODC Return 1 if we should choose a guard right away. */ -static int +STATIC int populate_live_entry_guards(smartlist_t *live_entry_guards, const smartlist_t *all_entry_guards, const node_t *chosen_exit, diff --git a/src/or/entrynodes.h b/src/or/entrynodes.h index e229f3b..d49ca50 100644 --- a/src/or/entrynodes.h +++ b/src/or/entrynodes.h @@ -77,6 +77,22 @@ int num_live_entry_guards(int for_directory);
#endif
+#ifdef ENTRYNODES_PRIVATE +STATIC const node_t *add_an_entry_guard(const node_t *chosen, + int reset_status, int prepend, + int for_discovery, int for_directory); + +STATIC int populate_live_entry_guards(smartlist_t *live_entry_guards, + const smartlist_t *all_entry_guards, + const node_t *chosen_exit, + dirinfo_type_t dirinfo_type, + int for_directory, + int need_uptime, int need_capacity); +STATIC int decide_num_guards(const or_options_t *options, int for_directory); + +STATIC void entry_guards_set_from_config(const or_options_t *options); +#endif + void remove_all_entry_guards(void);
void entry_guards_compute_status(const or_options_t *options, time_t now);