entrynodes: Better naming for dir info check functions.

This commit is contained in:
George Kadianakis 2017-10-03 15:50:54 +03:00
parent d891faddc7
commit f7306b16ec
4 changed files with 10 additions and 8 deletions

View File

@ -3446,7 +3446,7 @@ guards_retry_optimistic(const or_options_t *options)
* the genreal descriptor information <b>using_mds</b>, <b>num_present</b> and * the genreal descriptor information <b>using_mds</b>, <b>num_present</b> and
* <b>num_usable</b> to improve the error message. */ * <b>num_usable</b> to improve the error message. */
char * char *
guard_selection_get_dir_info_status_str(guard_selection_t *gs, guard_selection_get_err_str_if_dir_info_missing(guard_selection_t *gs,
int using_mds, int using_mds,
int num_present, int num_usable) int num_present, int num_usable)
{ {
@ -3492,10 +3492,11 @@ guard_selection_get_dir_info_status_str(guard_selection_t *gs,
/** As guard_selection_have_enough_dir_info_to_build_circuits, but uses /** As guard_selection_have_enough_dir_info_to_build_circuits, but uses
* the default guard selection. */ * the default guard selection. */
char * char *
entry_guards_get_dir_info_status_str(int using_mds, entry_guards_get_err_str_if_dir_info_missing(int using_mds,
int num_present, int num_usable) int num_present, int num_usable)
{ {
return guard_selection_get_dir_info_status_str(get_guard_selection_info(), return guard_selection_get_err_str_if_dir_info_missing(
get_guard_selection_info(),
using_mds, using_mds,
num_present, num_usable); num_present, num_usable);
} }

View File

@ -572,9 +572,9 @@ int getinfo_helper_entry_guards(control_connection_t *conn,
int entries_known_but_down(const or_options_t *options); int entries_known_but_down(const or_options_t *options);
void entries_retry_all(const or_options_t *options); void entries_retry_all(const or_options_t *options);
char *entry_guards_get_dir_info_status_str(int using_mds, char *entry_guards_get_err_str_if_dir_info_missing(int using_mds,
int num_present, int num_usable); int num_present, int num_usable);
char *guard_selection_get_dir_info_status_str(guard_selection_t *gs, char *guard_selection_get_err_str_if_dir_info_missing(guard_selection_t *gs,
int using_mds, int using_mds,
int num_present, int num_usable); int num_present, int num_usable);

View File

@ -2325,7 +2325,7 @@ update_router_have_minimum_dir_info(void)
} }
{ /* Check entry guard dirinfo status */ { /* Check entry guard dirinfo status */
char *guard_error = entry_guards_get_dir_info_status_str(using_md, char *guard_error = entry_guards_get_err_str_if_dir_info_missing(using_md,
num_present, num_present,
num_usable); num_usable);
if (guard_error) { if (guard_error) {

View File

@ -1643,7 +1643,8 @@ test_entry_guard_manage_primary(void *arg)
{ {
/* Check that we have all required dirinfo for the primaries (that's done /* Check that we have all required dirinfo for the primaries (that's done
* in big_fake_network_setup()) */ * in big_fake_network_setup()) */
char *dir_info_str = guard_selection_get_dir_info_status_str(gs, 0, 0, 0); char *dir_info_str =
guard_selection_get_err_str_if_dir_info_missing(gs, 0, 0, 0);
tt_assert(!dir_info_str); tt_assert(!dir_info_str);
/* Now artificially remove the first primary's descriptor and re-check */ /* Now artificially remove the first primary's descriptor and re-check */
@ -1652,7 +1653,7 @@ test_entry_guard_manage_primary(void *arg)
/* Change the first primary's identity digest so that the mocked functions /* Change the first primary's identity digest so that the mocked functions
* can't find its descriptor */ * can't find its descriptor */
memset(first_primary->identity, 9, sizeof(first_primary->identity)); memset(first_primary->identity, 9, sizeof(first_primary->identity));
dir_info_str = guard_selection_get_dir_info_status_str(gs, 1, 2, 3); dir_info_str =guard_selection_get_err_str_if_dir_info_missing(gs, 1, 2, 3);
tt_str_op(dir_info_str, OP_EQ, tt_str_op(dir_info_str, OP_EQ,
"We're missing descriptors for 1/2 of our primary entry guards " "We're missing descriptors for 1/2 of our primary entry guards "
"(total microdescriptors: 2/3)."); "(total microdescriptors: 2/3).");