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

[or-cvs] turn some knobs, add more debugging



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

Modified Files:
	circuit.c main.c onion.c 
Log Message:
turn some knobs, add more debugging


Index: circuit.c
===================================================================
RCS file: /home/or/cvsroot/src/or/circuit.c,v
retrieving revision 1.132
retrieving revision 1.133
diff -u -d -r1.132 -r1.133
--- circuit.c	20 Jan 2004 09:21:45 -0000	1.132
+++ circuit.c	30 Jan 2004 19:31:39 -0000	1.133
@@ -250,10 +250,10 @@
   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 @@
       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_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 @@
 
   hop->state = CPATH_STATE_OPEN;
   log_fn(LOG_INFO,"finished");
+  circuit_log_path(LOG_WARN,circ);
   return 0;
 }
 

Index: main.c
===================================================================
RCS file: /home/or/cvsroot/src/or/main.c,v
retrieving revision 1.166
retrieving revision 1.167
diff -u -d -r1.166 -r1.167
--- main.c	20 Jan 2004 09:21:46 -0000	1.166
+++ main.c	30 Jan 2004 19:31:39 -0000	1.167
@@ -341,9 +341,9 @@
       }
       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();

Index: onion.c
===================================================================
RCS file: /home/or/cvsroot/src/or/onion.c,v
retrieving revision 1.118
retrieving revision 1.119
diff -u -d -r1.118 -r1.119
--- onion.c	20 Jan 2004 03:12:46 -0000	1.118
+++ onion.c	30 Jan 2004 19:31:39 -0000	1.119
@@ -475,7 +475,8 @@
   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.",