summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2020-06-23 11:20:05 -0400
committerNick Mathewson <nickm@torproject.org>2020-06-23 11:20:05 -0400
commitb365179ee0061db2981f09025041a1065d0b283c (patch)
tree46ebdad3c7f6c5d42c1d4a1bb0219c216b78d87d /src
parentbc9979a670026004bf0a516bd38a25251ca6d9bb (diff)
downloadtor-b365179ee0061db2981f09025041a1065d0b283c.tar.gz
tor-b365179ee0061db2981f09025041a1065d0b283c.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/feature/relay/relay_periodic.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/feature/relay/relay_periodic.c b/src/feature/relay/relay_periodic.c
index 3171dffa5b..4e915f5e9f 100644
--- a/src/feature/relay/relay_periodic.c
+++ b/src/feature/relay/relay_periodic.c
@@ -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)