diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/or/circuitbuild.c | 2 | ||||
-rw-r--r-- | src/or/directory.c | 2 | ||||
-rw-r--r-- | src/or/entrynodes.c | 20 | ||||
-rw-r--r-- | src/or/entrynodes.h | 3 |
4 files changed, 14 insertions, 13 deletions
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c index cea1cbd52..753eaf8c1 100644 --- a/src/or/circuitbuild.c +++ b/src/or/circuitbuild.c @@ -3373,7 +3373,7 @@ choose_good_entry_server(uint8_t purpose, cpath_build_state_t *state) (purpose != CIRCUIT_PURPOSE_TESTING || options->BridgeRelay)) { /* This request is for an entry server to use for a regular circuit, * and we use entry guard nodes. Just return one of the guard nodes. */ - return choose_random_entry(state, NO_DIRINFO); + return choose_random_entry(state); } excluded = smartlist_new(); diff --git a/src/or/directory.c b/src/or/directory.c index a1ac2ad2e..6b61fc6a9 100644 --- a/src/or/directory.c +++ b/src/or/directory.c @@ -478,7 +478,7 @@ directory_get_from_dirserver(uint8_t dir_purpose, uint8_t router_purpose, */ /* XXX024 Not all bridges handle conditional consensus downloading, * so, for now, never assume the server supports that. -PP */ - const node_t *node = choose_random_entry(NULL, type); + const node_t *node = choose_random_dirguard(type); if (node && node->ri) { /* every bridge has a routerinfo. */ tor_addr_t addr; diff --git a/src/or/entrynodes.c b/src/or/entrynodes.c index dab081d1f..51c3a5674 100644 --- a/src/or/entrynodes.c +++ b/src/or/entrynodes.c @@ -848,6 +848,14 @@ node_understands_microdescriptors(const node_t *node) static int node_can_handle_dirinfo(const node_t *node, dirinfo_type_t dirinfo) { + /* Checking dirinfo for any type other than microdescriptors isn't required + yet, since we only choose directory guards that can support microdescs, + routerinfos, and networkstatuses, AND we don't use directory guards if + we're configured to do direct downloads of anything else. The only case + where we might have a guard that doesn't know about a type of directory + information is when we're retrieving directory information from a + bridge. */ + if ((dirinfo & MICRODESC_DIRINFO) && !node_understands_microdescriptors(node)) return 0; @@ -862,9 +870,9 @@ node_can_handle_dirinfo(const node_t *node, dirinfo_type_t dirinfo) * only select from nodes that know how to answer directory questions * of that type. */ const node_t * -choose_random_entry(cpath_build_state_t *state, dirinfo_type_t dirinfo) +choose_random_entry(cpath_build_state_t *state) { - return choose_random_entry_impl(state, 0, dirinfo); + return choose_random_entry_impl(state, 0, 0); } /** Pick a live (up and listed) directory guard from entry_guards for @@ -893,12 +901,6 @@ choose_random_entry_impl(cpath_build_state_t *state, int for_directory, const int num_needed = for_directory ? options->NumDirectoryGuards : options->NumEntryGuards; - /* Checking dirinfo_type isn't required yet, since we only choose directory - guards that can support microdescs, routerinfos, and networkstatuses, AND - we don't use directory guards if we're configured to do direct downloads - of anything else. */ - (void) dirinfo_type; - if (chosen_exit) { nodelist_add_node_and_family(exit_family, chosen_exit); consider_exit_family = 1; @@ -2012,7 +2014,7 @@ int any_bridge_descriptors_known(void) { tor_assert(get_options()->UseBridges); - return choose_random_entry(NULL, NO_DIRINFO)!=NULL ? 1 : 0; + return choose_random_entry(NULL) != NULL; } /** Return 1 if there are any directory conns fetching bridge descriptors diff --git a/src/or/entrynodes.h b/src/or/entrynodes.h index 235ef4bfd..e774a61a4 100644 --- a/src/or/entrynodes.h +++ b/src/or/entrynodes.h @@ -78,8 +78,7 @@ int entry_guard_register_connect_status(const char *digest, int succeeded, int mark_relay_status, time_t now); void entry_nodes_should_be_added(void); int entry_list_is_constrained(const or_options_t *options); -const node_t *choose_random_entry(cpath_build_state_t *state, - dirinfo_type_t dirinfo); +const node_t *choose_random_entry(cpath_build_state_t *state); const node_t *choose_random_dirguard(dirinfo_type_t t); int entry_guards_parse_state(or_state_t *state, int set, char **msg); void entry_guards_update_state(or_state_t *state); |