(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();
*/
/* 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;
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;
* 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
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;
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
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);