[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] try harder to establish reachability, in the first 20 minutes



Update of /home2/or/cvsroot/tor/src/or
In directory moria.mit.edu:/home2/arma/work/onion/cvs/tor/src/or

Modified Files:
	circuitbuild.c main.c 
Log Message:
try harder to establish reachability, in the first 20 minutes
of uptime.


Index: circuitbuild.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/circuitbuild.c,v
retrieving revision 1.94
retrieving revision 1.95
diff -u -d -r1.94 -r1.95
--- circuitbuild.c	26 Mar 2005 01:43:39 -0000	1.94
+++ circuitbuild.c	26 Mar 2005 05:54:50 -0000	1.95
@@ -468,7 +468,7 @@
         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");
       }

Index: main.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/main.c,v
retrieving revision 1.472
retrieving revision 1.473
diff -u -d -r1.472 -r1.473
--- main.c	26 Mar 2005 01:43:39 -0000	1.472
+++ main.c	26 Mar 2005 05:54:50 -0000	1.473
@@ -102,7 +102,8 @@
 #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 @@
   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 @@
   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. */