aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2006-09-15 05:53:00 +0000
committerRoger Dingledine <arma@torproject.org>2006-09-15 05:53:00 +0000
commitc22dc94fe6498a28c98f1f84e328d197472e4436 (patch)
tree1f904f0c2b751415d3e5fab8a1361f99a7e01ab7 /src
parent769f9201a68387c2cdf03e1efd28399c93bb2bdf (diff)
downloadtor-c22dc94fe6498a28c98f1f84e328d197472e4436.tar
tor-c22dc94fe6498a28c98f1f84e328d197472e4436.tar.gz
make my bandwidth exercises actually happen
svn:r8400
Diffstat (limited to 'src')
-rw-r--r--src/or/circuitbuild.c2
-rw-r--r--src/or/circuitlist.c5
-rw-r--r--src/or/circuituse.c3
-rw-r--r--src/or/main.c4
-rw-r--r--src/or/or.h2
-rw-r--r--src/or/router.c9
6 files changed, 15 insertions, 10 deletions
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index 2e0438ad6..73ec9417a 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -557,7 +557,7 @@ circuit_send_next_onion_skin(origin_circuit_t *circ)
"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);
diff --git a/src/or/circuitlist.c b/src/or/circuitlist.c
index d2f98c426..dba786486 100644
--- a/src/or/circuitlist.c
+++ b/src/or/circuitlist.c
@@ -672,7 +672,10 @@ circuit_get_next_by_pk_and_purpose(origin_circuit_t *start,
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;
diff --git a/src/or/circuituse.c b/src/or/circuituse.c
index db68b674a..5ac48047d 100644
--- a/src/or/circuituse.c
+++ b/src/or/circuituse.c
@@ -645,7 +645,8 @@ circuit_testing_opened(origin_circuit_t *circ)
} 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. */
diff --git a/src/or/main.c b/src/or/main.c
index 5e5be54eb..c09abefd8 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -574,7 +574,7 @@ directory_info_has_arrived(time_t now, int from_cache)
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 @@ run_scheduled_events(time_t now)
(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. */
diff --git a/src/or/or.h b/src/or/or.h
index 717d729fb..d7fba9c83 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -2443,7 +2443,7 @@ int init_keys(void);
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);
diff --git a/src/or/router.c b/src/or/router.c
index 2dbbefa2b..edec6282e 100644
--- a/src/or/router.c
+++ b/src/or/router.c
@@ -436,21 +436,21 @@ decide_to_advertise_dirport(or_options_t *options, routerinfo_t *router)
* 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 @@ router_perform_bandwidth_test(int num_circs, time_t now)
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 */