]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Code cleaned up to be less noisy
authorRoger Dingledine <arma@torproject.org>
Mon, 22 Jul 2002 04:08:37 +0000 (04:08 +0000)
committerRoger Dingledine <arma@torproject.org>
Mon, 22 Jul 2002 04:08:37 +0000 (04:08 +0000)
svn:r71

src/or/circuit.c
src/or/connection.c
src/or/connection_ap.c
src/or/main.c
src/or/routers.c

index 2758c13d21e7bbcc86b47e5a64e0d55f17ff3c90..52578d15b314932f8ebb0d68eff3f7a275a69d54 100644 (file)
@@ -262,15 +262,15 @@ int circuit_deliver_data_cell(cell_t *cell, circuit_t *circ, connection_t *conn,
   }
 
   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 aca385ffba9ea97b73678d48114eea6b06de8be7..bd6274098ec0f0bdcb9f034700191386a605237c 100644 (file)
@@ -465,14 +465,14 @@ int connection_send_destroy(aci_t aci, connection_t *conn) {
   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 a25e3d7f44ab21546be0918699b0c5fbc5e8c262..4996f9d881685f5365fddcc0ecf3c9baa0dcbf01 100644 (file)
@@ -16,7 +16,7 @@ int connection_ap_process_inbuf(connection_t *conn) {
     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 @@ int ap_handshake_send_onion(connection_t *ap_conn, connection_t *n_conn, circuit
 
   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 @@ int connection_ap_process_data_cell(cell_t *cell, connection_t *conn) {
     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 c96cf3930df145998468795feaad9a70d16168c1..dadfd9aa7a48fb7c9e1d010b61e276619bc250a0 100644 (file)
@@ -68,13 +68,13 @@ int connection_remove(connection_t *conn) {
   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 @@ int connection_remove(connection_t *conn) {
   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 @@ void check_conn_read(int i) {
     }
 
     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 8af6fd185b03a3db7d107bf7d22da63fa9589bd9..587c7a12612924f3e19a6f72147a644f303ec1bf 100644 (file)
@@ -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 @@ void delete_routerlist(routerinfo_t *list)
   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 @@ routerinfo_t **getrouters(char *routerfile, size_t *lenp, uint16_t or_listenport
   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 @@ routerinfo_t **getrouters(char *routerfile, size_t *lenp, uint16_t or_listenport
          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 @@ routerinfo_t **getrouters(char *routerfile, size_t *lenp, uint16_t or_listenport
                          }
                          
                          /* 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 @@ routerinfo_t **getrouters(char *routerfile, size_t *lenp, uint16_t or_listenport
                            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 @@ routerinfo_t **getrouters(char *routerfile, size_t *lenp, uint16_t or_listenport
   fclose(rf);
   return make_rarray(routerlist, lenp);
 }
+