summaryrefslogtreecommitdiff
path: root/src/or/router.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2005-03-26 01:43:39 +0000
committerRoger Dingledine <arma@torproject.org>2005-03-26 01:43:39 +0000
commit13283834829877d6cf81dd7d63224a650c89ad8d (patch)
tree96b2dca90b293c702dcf67ecc46a099cb765fcda /src/or/router.c
parente203d47192135079c34a6cf29307de5220126ee6 (diff)
downloadtor-13283834829877d6cf81dd7d63224a650c89ad8d.tar.gz
tor-13283834829877d6cf81dd7d63224a650c89ad8d.zip
make it clearer to the human that his server is testing
its reachability. tell him when it succeeds, or when 20 minutes pass and it hasn't succeeded yet. svn:r3882
Diffstat (limited to 'src/or/router.c')
-rw-r--r--src/or/router.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/or/router.c b/src/or/router.c
index 6fcba84ad1..6927f0e9bd 100644
--- a/src/or/router.c
+++ b/src/or/router.c
@@ -381,6 +381,15 @@ static int can_reach_or_port = 0;
/** Whether we can reach our DirPort from the outside. */
static int can_reach_dir_port = 0;
+/** Return 1 if all open ports are known reachable; else return 0. */
+int check_whether_ports_reachable(void) {
+ if (!can_reach_or_port)
+ return 0;
+ if (get_options()->DirPort && !can_reach_dir_port)
+ return 0;
+ return 1;
+}
+
void consider_testing_reachability(void) {
routerinfo_t *me = router_get_my_routerinfo();
@@ -397,11 +406,17 @@ void consider_testing_reachability(void) {
}
}
+static void ports_now_reachable(void) {
+ log_fn(LOG_NOTICE,"Your server is reachable. Publishing server descriptor.");
+}
+
/** Annotate that we found our ORPort reachable. */
void router_orport_found_reachable(void) {
if (!can_reach_or_port) {
log_fn(LOG_NOTICE,"Your ORPort is reachable from the outside. Excellent.");
can_reach_or_port = 1;
+ if (check_whether_ports_reachable())
+ ports_now_reachable();
}
}
@@ -410,6 +425,8 @@ void router_dirport_found_reachable(void) {
if (!can_reach_dir_port) {
log_fn(LOG_NOTICE,"Your DirPort is reachable from the outside. Excellent.");
can_reach_dir_port = 1;
+ if (check_whether_ports_reachable())
+ ports_now_reachable();
}
}
@@ -474,12 +491,7 @@ static int decide_if_publishable_server(time_t now) {
if (options->AuthoritativeDir)
return 1;
- if (!can_reach_or_port)
- return 0;
- if (options->DirPort && !can_reach_dir_port)
- return 0;
-
- return 1;
+ return check_whether_ports_reachable();
}
void consider_publishable_server(time_t now, int force) {