Commit c22dc94f authored by Roger Dingledine's avatar Roger Dingledine
Browse files

make my bandwidth exercises actually happen


svn:r8400
parent 769f9201
......@@ -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);
......
......@@ -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;
......
......@@ -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. */
......
......@@ -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. */
......
......@@ -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);
......
......@@ -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 */
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment