[or-cvs] better log output for debugging

Roger Dingledine arma at seul.org
Mon Aug 11 20:22:51 UTC 2003


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

Modified Files:
	main.c circuit.c 
Log Message:
better log output for debugging


Index: main.c
===================================================================
RCS file: /home/or/cvsroot/src/or/main.c,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -d -r1.78 -r1.79
--- main.c	6 Aug 2003 18:38:46 -0000	1.78
+++ main.c	11 Aug 2003 20:22:48 -0000	1.79
@@ -10,6 +10,9 @@
 
 /********* START VARIABLES **********/
 
+extern char *conn_type_to_string[];
+extern char *conn_state_to_string[][15];
+
 or_options_t options; /* command-line and config-file options */
 int global_read_bucket; /* max number of bytes I can read this second */
 
@@ -269,7 +272,7 @@
   }
 
   if(retval < 0) { /* this connection is broken. remove it */
-    log_fn(LOG_INFO,"Connection broken, removing."); 
+    log_fn(LOG_INFO,"%s connection broken, removing.", conn_type_to_string[conn->type]); 
     connection_remove(conn);
     connection_free(conn);
     if(i<nfds) { /* we just replaced the one at i with a new one.
@@ -300,7 +303,7 @@
   }
 
   if(retval < 0) { /* this connection is broken. remove it. */
-    log_fn(LOG_DEBUG,"Connection broken, removing.");
+    log_fn(LOG_DEBUG,"%s connection broken, removing.", conn_type_to_string[conn->type]);
     connection_remove(conn);
     connection_free(conn);
     if(i<nfds) { /* we just replaced the one at i with a new one.
@@ -597,8 +600,6 @@
   int i;
   connection_t *conn;
   struct timeval now;
-  extern char *conn_type_to_string[];
-  extern char *conn_state_to_string[][15];
 
   printf("Dumping stats:\n");
   my_gettimeofday(&now);

Index: circuit.c
===================================================================
RCS file: /home/or/cvsroot/src/or/circuit.c,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -d -r1.57 -r1.58
--- circuit.c	11 Aug 2003 19:48:22 -0000	1.57
+++ circuit.c	11 Aug 2003 20:22:48 -0000	1.58
@@ -805,7 +805,9 @@
     /* note also that this will close circuits where the onion has the same
      * router twice in a row in the path. i think that's ok. -RD
      */
-    log_fn(LOG_DEBUG,"Next router not connected. Closing.");
+    struct in_addr in;
+    in.s_addr = htonl(circ->n_addr);
+    log_fn(LOG_DEBUG,"Next router (%s:%d) not connected. Closing.", inet_ntoa(in), circ->n_port);
     /* XXX later we should fail more gracefully here, like with a 'truncated' */
     return -1;
   }



More information about the tor-commits mailing list