summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2004-01-30 19:31:39 +0000
committerRoger Dingledine <arma@torproject.org>2004-01-30 19:31:39 +0000
commitafdaff63ef6c81bdd7a1bec49b63e4571d5987b7 (patch)
tree945bbddf1e38464ffb8cd23a04f6eed6ad2a3725
parentb42b16357f4d7e0306bdc98804d08527134f7969 (diff)
downloadtor-afdaff63ef6c81bdd7a1bec49b63e4571d5987b7.tar.gz
tor-afdaff63ef6c81bdd7a1bec49b63e4571d5987b7.zip
turn some knobs, add more debugging
svn:r1023
-rw-r--r--src/or/circuit.c25
-rw-r--r--src/or/main.c4
-rw-r--r--src/or/onion.c3
3 files changed, 21 insertions, 11 deletions
diff --git a/src/or/circuit.c b/src/or/circuit.c
index 212d0560b7..4edf11cba5 100644
--- a/src/or/circuit.c
+++ b/src/or/circuit.c
@@ -250,10 +250,10 @@ circuit_t *circuit_get_newest(connection_t *conn, int must_be_open) {
return NULL;
}
-#define MIN_SECONDS_BEFORE_EXPIRING_CIRC 3
+#define MIN_SECONDS_BEFORE_EXPIRING_CIRC 10
/* circuits that were born at the end of their second might be expired
- * after 3.1 seconds; circuits born at the beginning might be expired
- * after closer to 4 seconds.
+ * after 10.1 seconds; circuits born at the beginning might be expired
+ * after closer to 11 seconds.
*/
/* close all circuits that start at us, aren't open, and were born
@@ -275,6 +275,7 @@ void circuit_expire_building(void) {
else
log_fn(LOG_INFO,"Abandoning circ %d (state %d:%s)", victim->n_circ_id,
victim->state, circuit_state_to_string[victim->state]);
+ circuit_log_path(LOG_INFO,victim);
circuit_close(victim);
}
}
@@ -739,19 +740,26 @@ void circuit_about_to_close_connection(connection_t *conn) {
void circuit_log_path(int severity, circuit_t *circ) {
static char b[1024];
struct crypt_path_t *hop;
+ char *states[] = {"closed", "waiting for keys", "open"};
routerinfo_t *router;
assert(circ->cpath);
- strcpy(b,"Stream is on circ: ");
- for(hop=circ->cpath;hop->next != circ->cpath; hop=hop->next) {
+
+ sprintf(b,"circ (length %d, exit %s): ",
+ circ->build_state->desired_path_len, circ->build_state->chosen_exit);
+ hop=circ->cpath;
+ do {
router = router_get_by_addr_port(hop->addr,hop->port);
if(router) {
- /* XXX strcat causes buffer overflow */
+ /* XXX strcat allows buffer overflow */
strcat(b,router->nickname);
- strcat(b,",");
+ strcat(b,"(");
+ strcat(b,states[hop->state]);
+ strcat(b,"),");
} else {
strcat(b,"UNKNOWN,");
}
- }
+ hop=hop->next;
+ } while(hop!=circ->cpath);
log_fn(severity,"%s",b);
}
@@ -1111,6 +1119,7 @@ int circuit_finish_handshake(circuit_t *circ, char *reply) {
hop->state = CPATH_STATE_OPEN;
log_fn(LOG_INFO,"finished");
+ circuit_log_path(LOG_WARN,circ);
return 0;
}
diff --git a/src/or/main.c b/src/or/main.c
index e8e5e7bfee..98a83e8042 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -341,9 +341,9 @@ static void run_scheduled_events(time_t now) {
}
time_to_new_circuit = now + options.NewCircuitPeriod;
}
-#define CIRCUIT_MIN_BUILDING 2
+#define CIRCUIT_MIN_BUILDING 3
if(!circ && circuit_count_building() < CIRCUIT_MIN_BUILDING) {
- /* if there's no open circ, and less than 2 are on the way,
+ /* if there's no open circ, and less than 3 are on the way,
* go ahead and try another.
*/
circuit_launch_new();
diff --git a/src/or/onion.c b/src/or/onion.c
index 2f13458e46..3912c450e7 100644
--- a/src/or/onion.c
+++ b/src/or/onion.c
@@ -475,7 +475,8 @@ int onion_extend_cpath(crypt_path_t **head_ptr, cpath_build_state_t *state, rout
add_nickname_list_to_smartlist(excludednodes,options.ExcludedNodes);
if(cur_len == state->desired_path_len - 1) { /* Picking last node */
- log_fn(LOG_DEBUG, "Contemplating last hop: choice already made.");
+ log_fn(LOG_DEBUG, "Contemplating last hop: choice already made: %s",
+ state->chosen_exit);
choice = router_get_by_nickname(state->chosen_exit);
if(!choice) {
log_fn(LOG_WARN,"Our chosen exit %s is no longer in the directory? Failing.",