aboutsummaryrefslogtreecommitdiff
path: root/src/feature/relay/selftest.c
diff options
context:
space:
mode:
authorteor <teor@torproject.org>2020-03-17 16:16:05 +1000
committerteor <teor@torproject.org>2020-03-20 18:05:10 +1000
commitfdba6ff0c0f27b9948101e63efd5acb965a2f6a3 (patch)
tree6fac49601c52f484c900e8890848ec820b8ea92e /src/feature/relay/selftest.c
parent07280c567e4afa9a74f203fbd22cc2cfcc34f875 (diff)
downloadtor-fdba6ff0c0f27b9948101e63efd5acb965a2f6a3.tar.gz
tor-fdba6ff0c0f27b9948101e63efd5acb965a2f6a3.zip
relay: Move inform_testing_rechability() to relay
Move inform_testing_rechability() to the relay module, and disable it when the relay module is disabled. Part of 33633.
Diffstat (limited to 'src/feature/relay/selftest.c')
-rw-r--r--src/feature/relay/selftest.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/feature/relay/selftest.c b/src/feature/relay/selftest.c
index 29febdee82..8aaf068f9c 100644
--- a/src/feature/relay/selftest.c
+++ b/src/feature/relay/selftest.c
@@ -213,6 +213,40 @@ router_do_reachability_checks(int test_or, int test_dir)
}
}
+/** We've decided to start our reachability testing. If all
+ * is set, log this to the user. Return 1 if we did, or 0 if
+ * we chose not to log anything. */
+int
+inform_testing_reachability(void)
+{
+ char dirbuf[128];
+ char *address;
+ const routerinfo_t *me = router_get_my_routerinfo();
+ if (!me)
+ return 0;
+ address = tor_dup_ip(me->addr);
+ control_event_server_status(LOG_NOTICE,
+ "CHECKING_REACHABILITY ORADDRESS=%s:%d",
+ address, me->or_port);
+ if (me->dir_port) {
+ tor_snprintf(dirbuf, sizeof(dirbuf), " and DirPort %s:%d",
+ address, me->dir_port);
+ control_event_server_status(LOG_NOTICE,
+ "CHECKING_REACHABILITY DIRADDRESS=%s:%d",
+ address, me->dir_port);
+ }
+ log_notice(LD_OR, "Now checking whether ORPort %s:%d%s %s reachable... "
+ "(this may take up to %d minutes -- look for log "
+ "messages indicating success)",
+ address, me->or_port,
+ me->dir_port ? dirbuf : "",
+ me->dir_port ? "are" : "is",
+ TIMEOUT_UNTIL_UNREACHABILITY_COMPLAINT/60);
+
+ tor_free(address);
+ return 1;
+}
+
/** Annotate that we found our ORPort reachable. */
void
router_orport_found_reachable(void)