summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2005-03-26 05:54:50 +0000
committerRoger Dingledine <arma@torproject.org>2005-03-26 05:54:50 +0000
commitb8d38dc57b79c63f6d1f796451d977c063478f50 (patch)
tree30e3f7e8ab2c0130b0f0e119e189ab0c2ab83643
parente692e7385311c56b0a84213c0f81a2178eddc07c (diff)
downloadtor-b8d38dc57b79c63f6d1f796451d977c063478f50.tar.gz
tor-b8d38dc57b79c63f6d1f796451d977c063478f50.zip
try harder to establish reachability, in the first 20 minutes
of uptime. svn:r3884
-rw-r--r--src/or/circuitbuild.c2
-rw-r--r--src/or/main.c12
2 files changed, 9 insertions, 5 deletions
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index f050a54f85..e394f6266f 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -468,7 +468,7 @@ int circuit_send_next_onion_skin(circuit_t *circ) {
log_fn(LOG_NOTICE,"Tor has successfully opened a circuit. Looks like it's working.");
/* XXX009 Log a count of known routers here */
if (server_mode(options) && !check_whether_ports_reachable())
- log_fn(LOG_NOTICE,"Now checking whether ORPort %s %s reachable...",
+ log_fn(LOG_NOTICE,"Now checking whether ORPort %s %s reachable... (this may take several minutes)",
options->DirPort ? "and DirPort" : "",
options->DirPort ? "are" : "is");
}
diff --git a/src/or/main.c b/src/or/main.c
index fcc9960da7..706ce05de0 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -102,7 +102,8 @@ static int nt_service_is_stopped(void);
#define nt_service_is_stopped() (0)
#endif
-#define CHECK_DESCRIPTOR_INTERVAL 60
+#define CHECK_DESCRIPTOR_INTERVAL 60 /* one minute */
+#define TIMEOUT_UNTIL_UNREACHABILITY_COMPLAINT (20*60) /* 20 minutes */
/********* END VARIABLES ************/
@@ -712,6 +713,10 @@ static void run_scheduled_events(time_t now) {
if (time_to_check_descriptor < now) {
time_to_check_descriptor = now + CHECK_DESCRIPTOR_INTERVAL;
consider_publishable_server(now, 0);
+ /* also, check religiously for reachability, if it's within the first
+ * 20 minutes of our uptime. */
+ if (stats_n_seconds_working < TIMEOUT_UNTIL_UNREACHABILITY_COMPLAINT)
+ consider_testing_reachability();
}
/** 3a. Every second, we examine pending circuits and prune the
@@ -806,15 +811,14 @@ static void second_elapsed_callback(int fd, short event, void *args)
stats_prev_global_read_bucket = global_read_bucket;
stats_prev_global_write_bucket = global_write_bucket;
-#define TIMEOUT_UNTIL_UNREACHABILITY_COMPLAINT (20*60) /* 20 minutes */
if (server_mode(options) &&
stats_n_seconds_working < TIMEOUT_UNTIL_UNREACHABILITY_COMPLAINT &&
stats_n_seconds_working+seconds_elapsed >=
TIMEOUT_UNTIL_UNREACHABILITY_COMPLAINT &&
!check_whether_ports_reachable()) {
routerinfo_t *me = router_get_my_routerinfo();
- tor_assert(me);
- log_fn(LOG_WARN,"Your server (%s:%d) has not managed to confirm that it is reachable. Please check your firewalls, ports, address, etc.", me->address, me->or_port);
+ log_fn(LOG_WARN,"Your server (%s:%d) has not managed to confirm that it is reachable. Please check your firewalls, ports, address, etc.",
+ me ? me->address : options->Address, options->ORPort);
}
/* if more than 10s have elapsed, probably the clock jumped: doesn't count. */