reachability_warnings_callback: simplify v4/v6_ok logic

Since "skip orport check" is the "and" of v4_ok and v6_ok, we can
just compute v4_ok and v6_ok once, to clarify that we don't enter
this block of code if they're both true.
This commit is contained in:
Nick Mathewson 2020-06-23 11:20:05 -04:00
parent bc9979a670
commit b365179ee0

View file

@ -201,15 +201,15 @@ reachability_warnings_callback(time_t now, const or_options_t *options)
have_completed_a_circuit()) {
/* every 20 minutes, check and complain if necessary */
const routerinfo_t *me = router_get_my_routerinfo();
if (me && !router_should_skip_orport_reachability_check(options)) {
bool v4_ok =
router_should_skip_orport_reachability_check_family(options,AF_INET);
bool v6_ok =
router_should_skip_orport_reachability_check_family(options,AF_INET6);
if (me && !(v4_ok && v6_ok)) {
/* We need to warn that one or more of our ORPorts isn't reachable.
* Determine which, and give a reasonable warning. */
char *address4 = tor_dup_ip(me->addr);
char *address6 = tor_addr_to_str_dup(&me->ipv6_addr);
bool v4_ok =
router_should_skip_orport_reachability_check_family(options,AF_INET);
bool v6_ok =
router_should_skip_orport_reachability_check_family(options,AF_INET6);
if (address4 || address6) {
char *where4=NULL, *where6=NULL;
if (!v4_ok)