mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-28 06:13:31 +01:00
but only do the rapid reachability testing if we're hoping to be a server.
svn:r3902
This commit is contained in:
parent
452563e157
commit
9b5432214d
@ -510,7 +510,6 @@ get_status_fetch_period(or_options_t *options)
|
|||||||
return 30*60;
|
return 30*60;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** This function is called whenever we successfully pull down a directory.
|
/** This function is called whenever we successfully pull down a directory.
|
||||||
* If <b>identity_digest</b> is defined, it contains the digest of the
|
* If <b>identity_digest</b> is defined, it contains the digest of the
|
||||||
* router that just gave us this directory. */
|
* router that just gave us this directory. */
|
||||||
@ -532,7 +531,8 @@ void directory_has_arrived(time_t now, char *identity_digest) {
|
|||||||
if (!time_to_fetch_running_routers)
|
if (!time_to_fetch_running_routers)
|
||||||
time_to_fetch_running_routers = now + get_status_fetch_period(options);
|
time_to_fetch_running_routers = now + get_status_fetch_period(options);
|
||||||
|
|
||||||
if (identity_digest) { /* if this is us, then our dirport is reachable */
|
if (server_mode(options) && identity_digest) {
|
||||||
|
/* if this is us, then our dirport is reachable */
|
||||||
routerinfo_t *router = router_get_by_digest(identity_digest);
|
routerinfo_t *router = router_get_by_digest(identity_digest);
|
||||||
if (!router) // XXX
|
if (!router) // XXX
|
||||||
log_fn(LOG_WARN,"Bug: router_get_by_digest doesn't find me.");
|
log_fn(LOG_WARN,"Bug: router_get_by_digest doesn't find me.");
|
||||||
@ -713,7 +713,8 @@ static void run_scheduled_events(time_t now) {
|
|||||||
consider_publishable_server(now, 0);
|
consider_publishable_server(now, 0);
|
||||||
/* also, check religiously for reachability, if it's within the first
|
/* also, check religiously for reachability, if it's within the first
|
||||||
* 20 minutes of our uptime. */
|
* 20 minutes of our uptime. */
|
||||||
if (stats_n_seconds_working < TIMEOUT_UNTIL_UNREACHABILITY_COMPLAINT)
|
if (server_mode(options) &&
|
||||||
|
stats_n_seconds_working < TIMEOUT_UNTIL_UNREACHABILITY_COMPLAINT)
|
||||||
consider_testing_reachability();
|
consider_testing_reachability();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -392,6 +392,10 @@ int check_whether_ports_reachable(void) {
|
|||||||
|
|
||||||
void consider_testing_reachability(void) {
|
void consider_testing_reachability(void) {
|
||||||
routerinfo_t *me = router_get_my_routerinfo();
|
routerinfo_t *me = router_get_my_routerinfo();
|
||||||
|
if (!me) {
|
||||||
|
log_fn(LOG_WARN,"Bug: router_get_my_routerinfo() did not find my routerinfo?");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!can_reach_or_port) {
|
if (!can_reach_or_port) {
|
||||||
circuit_launch_by_router(CIRCUIT_PURPOSE_TESTING, me, 0, 0, 1);
|
circuit_launch_by_router(CIRCUIT_PURPOSE_TESTING, me, 0, 0, 1);
|
||||||
|
Loading…
Reference in New Issue
Block a user