[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor/master] reachability_warnings_callback: simplify v4/v6_ok logic
commit b365179ee0061db2981f09025041a1065d0b283c
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date: Tue Jun 23 11:20:05 2020 -0400
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.
---
src/feature/relay/relay_periodic.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/feature/relay/relay_periodic.c b/src/feature/relay/relay_periodic.c
index 3171dffa5..4e915f5e9 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)
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits