mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-28 14:23:30 +01:00
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.
This commit is contained in:
parent
07280c567e
commit
fdba6ff0c0
@ -767,40 +767,6 @@ circuit_deliver_create_cell(circuit_t *circ, const create_cell_t *create_cell,
|
||||
return -1;
|
||||
}
|
||||
|
||||
/** 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;
|
||||
}
|
||||
|
||||
/** Return true iff we should send a create_fast cell to start building a given
|
||||
* circuit */
|
||||
static inline int
|
||||
|
@ -29,7 +29,6 @@ struct circuit_guard_state_t *origin_circuit_get_guard_state(
|
||||
int circuit_handle_first_hop(origin_circuit_t *circ);
|
||||
void circuit_n_chan_done(channel_t *chan, int status,
|
||||
int close_origin_circuits);
|
||||
int inform_testing_reachability(void);
|
||||
int circuit_timeout_want_to_count_circ(const origin_circuit_t *circ);
|
||||
int circuit_send_next_onion_skin(origin_circuit_t *circ);
|
||||
void circuit_note_clock_jumped(int64_t seconds_elapsed, bool was_idle);
|
||||
|
@ -29,7 +29,6 @@
|
||||
#include "core/mainloop/connection.h"
|
||||
#include "core/mainloop/cpuworker.h"
|
||||
#include "core/mainloop/mainloop.h"
|
||||
#include "core/or/circuitbuild.h"
|
||||
#include "core/or/connection_or.h"
|
||||
#include "core/or/port_cfg_st.h"
|
||||
|
||||
@ -44,6 +43,7 @@
|
||||
#include "feature/dircache/consdiffmgr.h"
|
||||
#include "feature/relay/dns.h"
|
||||
#include "feature/relay/routermode.h"
|
||||
#include "feature/relay/selftest.h"
|
||||
|
||||
/** Contents of most recently read DirPortFrontPage file. */
|
||||
static char *global_dirfrontpagecontents = NULL;
|
||||
|
@ -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)
|
||||
|
@ -20,6 +20,7 @@ int check_whether_dirport_reachable(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);
|
||||
int inform_testing_reachability(void);
|
||||
|
||||
void router_orport_found_reachable(void);
|
||||
void router_dirport_found_reachable(void);
|
||||
@ -47,6 +48,12 @@ router_perform_bandwidth_test(int num_circs, time_t now)
|
||||
(void)now;
|
||||
tor_assert_nonfatal_unreached();
|
||||
}
|
||||
static inline int
|
||||
inform_testing_reachability(void)
|
||||
{
|
||||
tor_assert_nonfatal_unreached();
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define router_orport_found_reachable() \
|
||||
STMT_NIL
|
||||
|
Loading…
Reference in New Issue
Block a user