[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[or-cvs] Code cleaned up to be less noisy



Update of /home/or/cvsroot/src/or
In directory moria.seul.org:/home/arma/work/onion/cvs/src/or

Modified Files:
	circuit.c connection.c connection_ap.c main.c routers.c 
Log Message:
Code cleaned up to be less noisy



Index: circuit.c
===================================================================
RCS file: /home/or/cvsroot/src/or/circuit.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- circuit.c	18 Jul 2002 23:44:57 -0000	1.8
+++ circuit.c	22 Jul 2002 04:08:37 -0000	1.9
@@ -262,15 +262,15 @@
   }
 
   if(conn->type == CONN_TYPE_EXIT) { /* send payload directly */
-    log(LOG_DEBUG,"circuit_deliver_data_cell(): Sending to exit.");
+//    log(LOG_DEBUG,"circuit_deliver_data_cell(): Sending to exit.");
     return connection_exit_process_data_cell(cell, conn);
   }
   if(conn->type == CONN_TYPE_AP) { /* send payload directly */
-    log(LOG_DEBUG,"circuit_deliver_data_cell(): Sending to AP.");
+//    log(LOG_DEBUG,"circuit_deliver_data_cell(): Sending to AP.");
     return connection_ap_process_data_cell(cell, conn);
   }
   /* else send it as a cell */
-  log(LOG_DEBUG,"circuit_deliver_data_cell(): Sending to connection.");
+//  log(LOG_DEBUG,"circuit_deliver_data_cell(): Sending to connection.");
   return connection_write_cell_to_buf(cell, conn);
 }
 

Index: connection.c
===================================================================
RCS file: /home/or/cvsroot/src/or/connection.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- connection.c	19 Jul 2002 18:48:28 -0000	1.10
+++ connection.c	22 Jul 2002 04:08:37 -0000	1.11
@@ -465,14 +465,14 @@
   assert(conn);
 
   if(!connection_speaks_cells(conn)) {
-     log(LOG_DEBUG,"connection_send_destroy(): At an edge. Marking connection for close.");
+     log(LOG_INFO,"connection_send_destroy(): Aci %d: At an edge. Marking connection for close.", aci);
      conn->marked_for_close = 1;
      return 0;
   }
 
   cell.aci = aci;
   cell.command = CELL_DESTROY;
-  log(LOG_DEBUG,"connection_send_destroy(): Sending destroy (aci %d).",aci);
+  log(LOG_INFO,"connection_send_destroy(): Sending destroy (aci %d).",aci);
   return connection_write_cell_to_buf(&cell, conn);
 
 }

Index: connection_ap.c
===================================================================
RCS file: /home/or/cvsroot/src/or/connection_ap.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- connection_ap.c	18 Jul 2002 23:44:57 -0000	1.6
+++ connection_ap.c	22 Jul 2002 04:08:37 -0000	1.7
@@ -16,7 +16,7 @@
     return -1;
   }
 
-  log(LOG_DEBUG,"connection_ap_process_inbuf(): state %d.",conn->state);
+//  log(LOG_DEBUG,"connection_ap_process_inbuf(): state %d.",conn->state);
 
   switch(conn->state) {
     case AP_CONN_STATE_SS_WAIT:
@@ -329,6 +329,7 @@
 
   circ->state = CIRCUIT_STATE_OPEN;
   ap_conn->state = AP_CONN_STATE_OPEN;
+  log(LOG_INFO,"ap_handshake_send_onion(): Address/port sent, ap socket %d, n_aci %d",ap_conn->s,circ->n_aci);
 
   /* FIXME should set circ->expire to something here */
 
@@ -351,7 +352,7 @@
     return -1;
   }
 
-  log(LOG_DEBUG,"connection_ap_process_data_cell(): In state 'open', writing to buf.");
+//  log(LOG_DEBUG,"connection_ap_process_data_cell(): In state 'open', writing to buf.");
 
   if(connection_write_to_buf(cell->payload, cell->length, conn) < 0)
     return -1;

Index: main.c
===================================================================
RCS file: /home/or/cvsroot/src/or/main.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- main.c	18 Jul 2002 23:44:57 -0000	1.14
+++ main.c	22 Jul 2002 04:08:37 -0000	1.15
@@ -68,13 +68,13 @@
   assert(conn);
   assert(nfds>0);
 
+  log(LOG_INFO,"connection_remove(): removing socket %d, nfds now %d",conn->s, nfds-1);
   circuit_about_to_close_connection(conn); /* flush and send destroys for all circuits on this conn */
 
   current_index = conn->poll_index;
   if(current_index == nfds-1) { /* this is the end */
 //    connection_free(conn);
     nfds--;
-    log(LOG_INFO,"connection_remove(): nfds now %d.",nfds);  
     return 0;
   } 
 
@@ -86,8 +86,6 @@
   connection_array[current_index] = connection_array[nfds];
   connection_array[current_index]->poll_index = current_index;
 
-  log(LOG_INFO,"connection_remove(): nfds now %d.",nfds);
-
   return 0;  
 }
 
@@ -285,7 +283,7 @@
     }
 
     if(retval < 0) { /* this connection is broken. remove it */
-      log(LOG_DEBUG,"check_conn_read(): Connection broken, removing."); 
+      log(LOG_INFO,"check_conn_read(): Connection broken, removing."); 
       connection_remove(conn);
       connection_free(conn);
       if(i<nfds) { /* we just replaced the one at i with a new one.

Index: routers.c
===================================================================
RCS file: /home/or/cvsroot/src/or/routers.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- routers.c	16 Jul 2002 01:12:15 -0000	1.4
+++ routers.c	22 Jul 2002 04:08:37 -0000	1.5
@@ -15,7 +15,7 @@
 #include "or.h"
 
 /* private function, to determine whether the current entry in the router list is actually us */
-static int routers_is_us(uint32_t or_address, uint16_t or_listenport, uint16_t my_or_listenport)
+static int router_is_me(uint32_t or_address, uint16_t or_listenport, uint16_t my_or_listenport)
 {
   /* local host information */
   char localhostname[512];
@@ -71,7 +71,7 @@
   return;
 }
 
-/* create an NULL-terminated array of pointers pointing to elements of a router list */
+/* create a NULL-terminated array of pointers pointing to elements of a router list */
 /* this is done in two passes through the list - inefficient but irrelevant as this is
  * only done once when op/or start up */
 routerinfo_t **make_rarray(routerinfo_t* list, size_t *len)
@@ -128,26 +128,22 @@
   char *errtest; /* detecting errors in strtoul() calls */
   struct hostent *rent;
 
-  if ((!routerfile) || (!lenp))
-    return NULL;
+  assert(routerfile && lenp);
   
-  if (strcspn(routerfile,CONFIG_LEGAL_FILENAME_CHARACTERS) != 0)
-  {
+  if (strcspn(routerfile,CONFIG_LEGAL_FILENAME_CHARACTERS) != 0) {
     log(LOG_ERR,"Filename %s contains illegal characters.",routerfile);
     return NULL;
   }
   
   /* open the router list */
   rf = fopen(routerfile,"r");
-  if (!rf)
-  {
+  if (!rf) {
     log(LOG_ERR,"Could not open %s.",routerfile);
     return NULL;
   }
   
-  retp= fgets(line,512,rf);
-  while (retp)
-  {
+  retp = fgets(line,512,rf);
+  while (retp) {
     log(LOG_DEBUG,"getrouters():Line :%s",line);
     token = (char *)strtok(line,OR_ROUTERLIST_SEPCHARS);
     if (token)
@@ -164,15 +160,6 @@
 	  return NULL;
 	}
 	
-#if 0
-	router->conn_bufs = NULL; /* no output buffers */
-	router->last_conn_buf = NULL;
-	router->next_to_service = 0;
-	
-	router->s = -1; /* to signify this router is as yet unconnected */
-	router->celllen = 0; /* cell buffer is empty */
-#endif
-	
 	/* read the address */
 	router->address = malloc(strlen(token)+1);
 	if (!router->address)
@@ -315,7 +302,7 @@
 			  }
 			  
 			  /* check that this router doesn't actually represent us */
-			  retval = routers_is_us(router->addr, router->or_port, or_listenport);
+			  retval = router_is_me(router->addr, router->or_port, or_listenport);
 			  if (!retval) { /* this isn't us, continue */
 			    router->next = NULL;
 			    /* save the entry into the routerlist linked list */
@@ -332,7 +319,7 @@
 			    RSA_free(router->pkey);
 			    free((void *)router);
 			  }
-			  else /* routers_is_us() returned an error */
+			  else /* router_is_me() returned an error */
 			  {
 			    free((void *)router->address);
 			    RSA_free(router->pkey);
@@ -430,3 +417,4 @@
   fclose(rf);
   return make_rarray(routerlist, lenp);
 }
+