Wrap long lines

This commit is contained in:
teor 2020-05-07 20:16:56 +10:00
parent 05c56ae455
commit 74902c8aca
7 changed files with 39 additions and 23 deletions

View File

@ -1659,7 +1659,8 @@ static void
circuit_testing_failed(origin_circuit_t *circ, int at_last_hop)
{
const or_options_t *options = get_options();
if (server_mode(options) && router_should_skip_orport_reachability_check(options))
if (server_mode(options) &&
router_should_skip_orport_reachability_check(options))
return;
log_info(LD_GENERAL,

View File

@ -1276,15 +1276,18 @@ getinfo_helper_events(control_connection_t *control_conn,
*answer = tor_strdup(directories_have_accepted_server_descriptor()
? "1" : "0");
} else if (!strcmp(question, "status/reachability-succeeded/or")) {
*answer = tor_strdup(router_should_skip_orport_reachability_check(options) ?
"1" : "0");
*answer = tor_strdup(
router_should_skip_orport_reachability_check(options) ?
"1" : "0");
} else if (!strcmp(question, "status/reachability-succeeded/dir")) {
*answer = tor_strdup(router_should_skip_dirport_reachability_check(options) ?
"1" : "0");
*answer = tor_strdup(
router_should_skip_dirport_reachability_check(options) ?
"1" : "0");
} else if (!strcmp(question, "status/reachability-succeeded")) {
tor_asprintf(answer, "OR=%d DIR=%d",
router_should_skip_orport_reachability_check(options) ? 1 : 0,
router_should_skip_dirport_reachability_check(options) ? 1 : 0);
tor_asprintf(
answer, "OR=%d DIR=%d",
router_should_skip_orport_reachability_check(options) ? 1 : 0,
router_should_skip_dirport_reachability_check(options) ? 1 : 0);
} else if (!strcmp(question, "status/bootstrap-phase")) {
*answer = control_event_boot_last_msg();
} else if (!strcmpstart(question, "status/version/")) {

View File

@ -321,10 +321,12 @@ router_pick_directory_server_impl(dirinfo_type_t type, int flags,
overloaded_direct = smartlist_new();
overloaded_tunnel = smartlist_new();
const int skip_or_fw = client_or_conn_should_skip_reachable_address_check(options,
const int skip_or_fw = client_or_conn_should_skip_reachable_address_check(
options,
try_ip_pref);
const int skip_dir_fw = client_dir_conn_should_skip_reachable_address_check(
options,
try_ip_pref);
const int skip_dir_fw = client_dir_conn_should_skip_reachable_address_check(options,
try_ip_pref);
const int must_have_or = dirclient_must_use_begindir(options);
/* Find all the running dirservers we know about. */
@ -1122,10 +1124,12 @@ router_pick_trusteddirserver_impl(const smartlist_t *sourcelist,
overloaded_direct = smartlist_new();
overloaded_tunnel = smartlist_new();
const int skip_or_fw = client_or_conn_should_skip_reachable_address_check(options,
const int skip_or_fw = client_or_conn_should_skip_reachable_address_check(
options,
try_ip_pref);
const int skip_dir_fw = client_dir_conn_should_skip_reachable_address_check(
options,
try_ip_pref);
const int skip_dir_fw = client_dir_conn_should_skip_reachable_address_check(options,
try_ip_pref);
const int must_have_or = dirclient_must_use_begindir(options);
SMARTLIST_FOREACH_BEGIN(sourcelist, const dir_server_t *, d)

View File

@ -476,7 +476,8 @@ router_reload_router_list(void)
* Finally, return true if ReachableAddresses is set.
*/
int
client_or_conn_should_skip_reachable_address_check(const or_options_t *options,
client_or_conn_should_skip_reachable_address_check(
const or_options_t *options,
int try_ip_pref)
{
/* Servers always have and prefer IPv4.
@ -491,7 +492,8 @@ client_or_conn_should_skip_reachable_address_check(const or_options_t *options,
* This function is obsolete, because clients only use ORPorts.
*/
int
client_dir_conn_should_skip_reachable_address_check(const or_options_t *options,
client_dir_conn_should_skip_reachable_address_check(
const or_options_t *options,
int try_ip_pref)
{
/* Servers always have and prefer IPv4.
@ -518,7 +520,8 @@ router_add_running_nodes_to_smartlist(smartlist_t *sl, int need_uptime,
int need_desc, int pref_addr,
int direct_conn)
{
const int check_reach = !client_or_conn_should_skip_reachable_address_check(get_options(),
const int check_reach = !client_or_conn_should_skip_reachable_address_check(
get_options(),
pref_addr);
/* XXXX MOVE */
SMARTLIST_FOREACH_BEGIN(nodelist_get_list(), const node_t *, node) {

View File

@ -50,10 +50,12 @@ typedef enum was_router_added_t {
int router_reload_router_list(void);
int client_or_conn_should_skip_reachable_address_check(const or_options_t *options,
int client_or_conn_should_skip_reachable_address_check(
const or_options_t *options,
int try_ip_pref);
int client_dir_conn_should_skip_reachable_address_check(
const or_options_t *options,
int try_ip_pref);
int client_dir_conn_should_skip_reachable_address_check(const or_options_t *options,
int try_ip_pref);
void router_reset_status_download_failures(void);
int routers_have_same_or_addrs(const routerinfo_t *r1, const routerinfo_t *r2);
void router_add_running_nodes_to_smartlist(smartlist_t *sl, int need_uptime,

View File

@ -154,7 +154,8 @@ extend_info_from_router(const routerinfo_t *r, int family)
/* Relays always assume that the first hop is reachable. They ignore
* ReachableAddresses. */
tor_assert_nonfatal(client_or_conn_should_skip_reachable_address_check(get_options(), 0));
tor_assert_nonfatal(client_or_conn_should_skip_reachable_address_check(
get_options(), 0));
const ed25519_public_key_t *ed_id_key;
if (r->cache_info.signing_key_cert)

View File

@ -15,8 +15,10 @@
#ifdef HAVE_MODULE_RELAY
struct or_options_t;
int router_should_skip_orport_reachability_check(const struct or_options_t *options);
int router_should_skip_dirport_reachability_check(const struct or_options_t *options);
int router_should_skip_orport_reachability_check(
const struct or_options_t *options);
int router_should_skip_dirport_reachability_check(
const struct or_options_t *options);
void router_do_reachability_checks(int test_or, int test_dir);
void router_perform_bandwidth_test(int num_circs, time_t now);