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

[or-cvs] r8400: make my bandwidth exercises actually happen (tor/trunk/src/or)



Author: arma
Date: 2006-09-15 01:53:00 -0400 (Fri, 15 Sep 2006)
New Revision: 8400

Modified:
   tor/trunk/src/or/circuitbuild.c
   tor/trunk/src/or/circuitlist.c
   tor/trunk/src/or/circuituse.c
   tor/trunk/src/or/main.c
   tor/trunk/src/or/or.h
   tor/trunk/src/or/router.c
Log:
make my bandwidth exercises actually happen


Modified: tor/trunk/src/or/circuitbuild.c
===================================================================
--- tor/trunk/src/or/circuitbuild.c	2006-09-15 05:30:25 UTC (rev 8399)
+++ tor/trunk/src/or/circuitbuild.c	2006-09-15 05:53:00 UTC (rev 8400)
@@ -557,7 +557,7 @@
             "Looks like client functionality is working.");
         if (server_mode(options) && !check_whether_orport_reachable()) {
           inform_testing_reachability();
-          consider_testing_reachability();
+          consider_testing_reachability(1, 1);
         }
       }
       circuit_rep_hist_note_result(circ);

Modified: tor/trunk/src/or/circuitlist.c
===================================================================
--- tor/trunk/src/or/circuitlist.c	2006-09-15 05:30:25 UTC (rev 8399)
+++ tor/trunk/src/or/circuitlist.c	2006-09-15 05:53:00 UTC (rev 8400)
@@ -672,8 +672,11 @@
       continue;
     if (circ->purpose != purpose)
       continue;
-    if (!memcmp(TO_ORIGIN_CIRCUIT(circ)->rend_pk_digest, digest, DIGEST_LEN))
+    if (!digest)
       return TO_ORIGIN_CIRCUIT(circ);
+    else if (!memcmp(TO_ORIGIN_CIRCUIT(circ)->rend_pk_digest,
+                     digest, DIGEST_LEN))
+      return TO_ORIGIN_CIRCUIT(circ);
   }
   return NULL;
 }

Modified: tor/trunk/src/or/circuituse.c
===================================================================
--- tor/trunk/src/or/circuituse.c	2006-09-15 05:30:25 UTC (rev 8399)
+++ tor/trunk/src/or/circuituse.c	2006-09-15 05:53:00 UTC (rev 8400)
@@ -645,7 +645,8 @@
   } else if (circuit_enough_testing_circs()) {
     router_perform_bandwidth_test(NUM_PARALLEL_TESTING_CIRCS, time(NULL));
     have_performed_bandwidth_test = 1;
-  }
+  } else
+    consider_testing_reachability(1, 0);
 }
 
 /** A testing circuit has failed to build. Take whatever stats we want. */

Modified: tor/trunk/src/or/main.c
===================================================================
--- tor/trunk/src/or/main.c	2006-09-15 05:30:25 UTC (rev 8399)
+++ tor/trunk/src/or/main.c	2006-09-15 05:53:00 UTC (rev 8400)
@@ -574,7 +574,7 @@
 
   if (server_mode(options) && !we_are_hibernating() && !from_cache &&
       (has_completed_circuit || !any_predicted_circuits(now)))
-    consider_testing_reachability();
+    consider_testing_reachability(1, 1);
 }
 
 /** Perform regular maintenance tasks for a single connection.  This
@@ -847,7 +847,7 @@
         (has_completed_circuit || !any_predicted_circuits(now)) &&
         stats_n_seconds_working < TIMEOUT_UNTIL_UNREACHABILITY_COMPLAINT &&
         !we_are_hibernating())
-      consider_testing_reachability();
+      consider_testing_reachability(1, 1);
 
     /* If any networkstatus documents are no longer recent, we need to
      * update all the descriptors' running status. */

Modified: tor/trunk/src/or/or.h
===================================================================
--- tor/trunk/src/or/or.h	2006-09-15 05:30:25 UTC (rev 8399)
+++ tor/trunk/src/or/or.h	2006-09-15 05:53:00 UTC (rev 8400)
@@ -2443,7 +2443,7 @@
 
 int check_whether_orport_reachable(void);
 int check_whether_dirport_reachable(void);
-void consider_testing_reachability(void);
+void consider_testing_reachability(int test_or, int test_dir);
 void router_orport_found_reachable(void);
 void router_dirport_found_reachable(void);
 void server_has_changed_ip(void);

Modified: tor/trunk/src/or/router.c
===================================================================
--- tor/trunk/src/or/router.c	2006-09-15 05:30:25 UTC (rev 8399)
+++ tor/trunk/src/or/router.c	2006-09-15 05:53:00 UTC (rev 8400)
@@ -436,21 +436,21 @@
  * Success is noticed in connection_dir_client_reached_eof().
  */
 void
-consider_testing_reachability(void)
+consider_testing_reachability(int test_or, int test_dir)
 {
   routerinfo_t *me = router_get_my_routerinfo();
-  int orport_reachable = !check_whether_orport_reachable();
+  int orport_reachable = check_whether_orport_reachable();
   if (!me)
     return;
 
-  if (!orport_reachable || !circuit_enough_testing_circs()) {
+  if (test_or && (!orport_reachable || !circuit_enough_testing_circs())) {
     log_info(LD_CIRC, "Testing %s of my ORPort: %s:%d.",
              !orport_reachable ? "reachability" : "bandwidth",
              me->address, me->or_port);
     circuit_launch_by_router(CIRCUIT_PURPOSE_TESTING, me, 0, 1, 1);
   }
 
-  if (!check_whether_dirport_reachable()) {
+  if (test_dir && !check_whether_dirport_reachable()) {
     /* ask myself, via tor, for my server descriptor. */
     directory_initiate_command_router(me, DIR_PURPOSE_FETCH_SERVERDESC,
                                       1, "authority", NULL, 0);
@@ -505,6 +505,7 @@
   int cells_per_circuit = max_cells / num_circs;
   origin_circuit_t *circ = NULL;
 
+  log_notice(LD_OR,"Performing bandwidth self-test.");
   while ((circ = circuit_get_next_by_pk_and_purpose(circ, NULL,
                                               CIRCUIT_PURPOSE_TESTING))) {
     /* dump cells_per_circuit drop cells onto this circ */