[or-cvs] make circuit building and router parsing less noisy

Roger Dingledine arma at seul.org
Sat Dec 4 00:25:58 UTC 2004


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

Modified Files:
	circuitbuild.c routerparse.c 
Log Message:
make circuit building and router parsing less noisy


Index: circuitbuild.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/circuitbuild.c,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -d -r1.66 -r1.67
--- circuitbuild.c	30 Nov 2004 10:47:48 -0000	1.66
+++ circuitbuild.c	4 Dec 2004 00:25:54 -0000	1.67
@@ -563,15 +563,15 @@
   tor_assert(!(cpath->f_crypto || cpath->b_crypto ||
              cpath->f_digest || cpath->b_digest));
 
-  log_fn(LOG_DEBUG,"hop init digest forward 0x%.8x, backward 0x%.8x.",
-         (unsigned int)*(uint32_t*)key_data, (unsigned int)*(uint32_t*)(key_data+20));
+//  log_fn(LOG_DEBUG,"hop init digest forward 0x%.8x, backward 0x%.8x.",
+//         (unsigned int)*(uint32_t*)key_data, (unsigned int)*(uint32_t*)(key_data+20));
   cpath->f_digest = crypto_new_digest_env();
   crypto_digest_add_bytes(cpath->f_digest, key_data, DIGEST_LEN);
   cpath->b_digest = crypto_new_digest_env();
   crypto_digest_add_bytes(cpath->b_digest, key_data+DIGEST_LEN, DIGEST_LEN);
 
-  log_fn(LOG_DEBUG,"hop init cipher forward 0x%.8x, backward 0x%.8x.",
-         (unsigned int)*(uint32_t*)(key_data+40), (unsigned int)*(uint32_t*)(key_data+40+16));
+//  log_fn(LOG_DEBUG,"hop init cipher forward 0x%.8x, backward 0x%.8x.",
+//         (unsigned int)*(uint32_t*)(key_data+40), (unsigned int)*(uint32_t*)(key_data+40+16));
   if (!(cpath->f_crypto =
         crypto_create_init_cipher(key_data+(2*DIGEST_LEN),1))) {
     log(LOG_WARN,"forward cipher initialization failed.");
@@ -825,8 +825,8 @@
         !circuit_stream_is_being_handled(carray[i]))
       ++n_pending_connections;
   }
-  log_fn(LOG_DEBUG, "Choosing exit node; %d connections are pending",
-         n_pending_connections);
+//  log_fn(LOG_DEBUG, "Choosing exit node; %d connections are pending",
+//         n_pending_connections);
   /* Now we count, for each of the routers in the directory, how many
    * of the pending connections could possibly exit from that
    * router (n_supported[i]). (We can't be sure about cases where we
@@ -837,7 +837,7 @@
     router = smartlist_get(dir->routers, i);
     if (router_is_me(router)) {
       n_supported[i] = -1;
-      log_fn(LOG_DEBUG,"Skipping node %s -- it's me.", router->nickname);
+//      log_fn(LOG_DEBUG,"Skipping node %s -- it's me.", router->nickname);
       /* XXX there's probably a reverse predecessor attack here, but
        * it's slow. should we take this out? -RD
        */
@@ -845,8 +845,8 @@
     }
     if (!router->is_running) {
       n_supported[i] = -1;
-      log_fn(LOG_DEBUG,"Skipping node %s (index %d) -- directory says it's not running.",
-             router->nickname, i);
+//      log_fn(LOG_DEBUG,"Skipping node %s (index %d) -- directory says it's not running.",
+//             router->nickname, i);
       continue; /* skip routers that are known to be down */
     }
     if (!router->is_verified &&
@@ -854,20 +854,20 @@
          router_is_unreliable_router(router, 1, 1))) {
       /* if it's unverified, and either we don't want it or it's unsuitable */
       n_supported[i] = -1;
-      log_fn(LOG_DEBUG,"Skipping node %s (index %d) -- unverified router.",
-             router->nickname, i);
+//      log_fn(LOG_DEBUG,"Skipping node %s (index %d) -- unverified router.",
+//             router->nickname, i);
       continue; /* skip unverified routers */
     }
     if (router_exit_policy_rejects_all(router)) {
       n_supported[i] = -1;
-      log_fn(LOG_DEBUG,"Skipping node %s (index %d) -- it rejects all.",
-             router->nickname, i);
+//      log_fn(LOG_DEBUG,"Skipping node %s (index %d) -- it rejects all.",
+//             router->nickname, i);
       continue; /* skip routers that reject all */
     }
     if (smartlist_len(preferredentries)==1 &&
         router == (routerinfo_t*)smartlist_get(preferredentries, 0)) {
       n_supported[i] = -1;
-      log_fn(LOG_DEBUG,"Skipping node %s (index %d) -- it's our only preferred entry node.", router->nickname, i);
+//      log_fn(LOG_DEBUG,"Skipping node %s (index %d) -- it's our only preferred entry node.", router->nickname, i);
       continue;
     }
     n_supported[i] = 0;
@@ -879,19 +879,19 @@
         continue; /* Skip everything but APs in CIRCUIT_WAIT */
       if (connection_ap_can_use_exit(carray[j], router)) {
         ++n_supported[i];
-        log_fn(LOG_DEBUG,"%s is supported. n_supported[%d] now %d.",
-               router->nickname, i, n_supported[i]);
+//        log_fn(LOG_DEBUG,"%s is supported. n_supported[%d] now %d.",
+//               router->nickname, i, n_supported[i]);
       } else {
-        log_fn(LOG_DEBUG,"%s (index %d) would reject this stream.",
-               router->nickname, i);
+//        log_fn(LOG_DEBUG,"%s (index %d) would reject this stream.",
+//               router->nickname, i);
       }
     } /* End looping over connections. */
     if (n_supported[i] > best_support) {
       /* If this router is better than previous ones, remember its index
        * and goodness, and start counting how many routers are this good. */
       best_support = n_supported[i]; n_best_support=1;
-      log_fn(LOG_DEBUG,"%s is new best supported option so far.",
-             router->nickname);
+//      log_fn(LOG_DEBUG,"%s is new best supported option so far.",
+//             router->nickname);
     } else if (n_supported[i] == best_support) {
       /* If this router is _as good_ as the best one, just increment the
        * count of equally good routers.*/
@@ -1032,19 +1032,19 @@
   n = smartlist_len(routers);
   for (i=0;i<n;i++) {
     r = smartlist_get(routers, i);
-    log_fn(LOG_DEBUG,"Contemplating whether router %d (%s) is a new option...",
-           i, r->nickname);
+//    log_fn(LOG_DEBUG,"Contemplating whether router %d (%s) is a new option...",
+//           i, r->nickname);
     if (r->is_running == 0) {
-      log_fn(LOG_DEBUG,"Nope, the directory says %d is not running.",i);
+//      log_fn(LOG_DEBUG,"Nope, the directory says %d is not running.",i);
       goto next_i_loop;
     }
     if (r->is_verified == 0) {
-      log_fn(LOG_DEBUG,"Nope, the directory says %d is not verified.",i);
+//      log_fn(LOG_DEBUG,"Nope, the directory says %d is not verified.",i);
       /* XXXX009 But unverified routers *are* sometimes acceptable. */
       goto next_i_loop;
     }
     num++;
-    log_fn(LOG_DEBUG,"I like %d. num_acceptable_routers now %d.",i, num);
+//    log_fn(LOG_DEBUG,"I like %d. num_acceptable_routers now %d.",i, num);
     next_i_loop:
       ; /* C requires an explicit statement after the label */
   }

Index: routerparse.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/routerparse.c,v
retrieving revision 1.91
retrieving revision 1.92
diff -u -d -r1.91 -r1.92
--- routerparse.c	1 Dec 2004 03:48:14 -0000	1.91
+++ routerparse.c	4 Dec 2004 00:25:54 -0000	1.92
@@ -725,7 +725,7 @@
       router->status_set_at = time(NULL);
     }
     smartlist_add(routers, router);
-    log_fn(LOG_DEBUG,"just added router #%d.",smartlist_len(routers));
+//    log_fn(LOG_DEBUG,"just added router #%d.",smartlist_len(routers));
   }
 
   if (good_nickname_list) {
@@ -945,9 +945,9 @@
     router->platform = tor_strdup("<unknown>");
   }
 
-  log_fn(LOG_DEBUG,"or_port %d, socks_port %d, dir_port %d, bandwidthrate %u, bandwidthburst %u.",
-    router->or_port, router->socks_port, router->dir_port,
-    (unsigned) router->bandwidthrate, (unsigned) router->bandwidthburst);
+//  log_fn(LOG_DEBUG,"or_port %d, socks_port %d, dir_port %d, bandwidthrate %u, bandwidthburst %u.",
+//    router->or_port, router->socks_port, router->dir_port,
+//    (unsigned) router->bandwidthrate, (unsigned) router->bandwidthburst);
 
   goto done;
   return router;
@@ -1052,8 +1052,8 @@
   newe = tor_malloc_zero(sizeof(struct addr_policy_t));
 
   newe->string = tor_malloc(8+strlen(arg));
-  tor_snprintf(newe->string, 8+strlen(arg), "%s %s",
-           (tok->tp == K_REJECT) ? "reject" : "accept", arg);
+//  tor_snprintf(newe->string, 8+strlen(arg), "%s %s",
+//           (tok->tp == K_REJECT) ? "reject" : "accept", arg);
   newe->policy_type = (tok->tp == K_REJECT) ? ADDR_POLICY_REJECT
     : ADDR_POLICY_ACCEPT;
 
@@ -1063,10 +1063,10 @@
 
   in.s_addr = htonl(newe->addr);
   address = tor_strdup(inet_ntoa(in));
-  in.s_addr = htonl(newe->msk);
-  log_fn(LOG_DEBUG,"%s %s/%s:%d-%d",
-         newe->policy_type == ADDR_POLICY_REJECT ? "reject" : "accept",
-         address, inet_ntoa(in), newe->prt_min, newe->prt_max);
+//  in.s_addr = htonl(newe->msk);
+//  log_fn(LOG_DEBUG,"%s %s/%s:%d-%d",
+//         newe->policy_type == ADDR_POLICY_REJECT ? "reject" : "accept",
+//         address, inet_ntoa(in), newe->prt_min, newe->prt_max);
   tor_free(address);
 
   return newe;



More information about the tor-commits mailing list