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

[or-cvs] but only do the rapid reachability testing if we"re hoping ...



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

Modified Files:
	main.c router.c 
Log Message:
but only do the rapid reachability testing if we're hoping to be a server.


Index: main.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/main.c,v
retrieving revision 1.476
retrieving revision 1.477
diff -u -d -r1.476 -r1.477
--- main.c	27 Mar 2005 06:50:36 -0000	1.476
+++ main.c	27 Mar 2005 11:52:15 -0000	1.477
@@ -510,7 +510,6 @@
     return 30*60;
 }
 
-
 /** This function is called whenever we successfully pull down a directory.
  * If <b>identity_digest</b> is defined, it contains the digest of the
  * router that just gave us this directory. */
@@ -532,7 +531,8 @@
   if (!time_to_fetch_running_routers)
     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);
     if (!router) // XXX
       log_fn(LOG_WARN,"Bug: router_get_by_digest doesn't find me.");
@@ -713,7 +713,8 @@
     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)
+    if (server_mode(options) &&
+        stats_n_seconds_working < TIMEOUT_UNTIL_UNREACHABILITY_COMPLAINT)
       consider_testing_reachability();
   }
 

Index: router.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/router.c,v
retrieving revision 1.160
retrieving revision 1.161
diff -u -d -r1.160 -r1.161
--- router.c	26 Mar 2005 01:43:39 -0000	1.160
+++ router.c	27 Mar 2005 11:52:15 -0000	1.161
@@ -392,6 +392,10 @@
 
 void consider_testing_reachability(void) {
   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) {
     circuit_launch_by_router(CIRCUIT_PURPOSE_TESTING, me, 0, 0, 1);