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

[or-cvs] r8890: Add some temporary code to count how many *distinct* router (in tor/trunk: . src/or)



Author: nickm
Date: 2006-11-01 13:16:44 -0500 (Wed, 01 Nov 2006)
New Revision: 8890

Modified:
   tor/trunk/
   tor/trunk/src/or/main.c
   tor/trunk/src/or/routerparse.c
Log:
 r9465@auth3-479:  nickm | 2006-11-01 13:16:21 -0500
 Add some temporary code to count  how many *distinct* router digests we verify.  (I have a sneaking suspicion that the numbers look way way high.)



Property changes on: tor/trunk
___________________________________________________________________
 svk:merge ticket from /tor/trunk [r9465] on c95137ef-5f19-0410-b913-86e773d04f59

Modified: tor/trunk/src/or/main.c
===================================================================
--- tor/trunk/src/or/main.c	2006-11-01 13:33:49 UTC (rev 8889)
+++ tor/trunk/src/or/main.c	2006-11-01 18:16:44 UTC (rev 8890)
@@ -1333,6 +1333,7 @@
 extern uint64_t buf_total_alloc;
 extern uint64_t rephist_total_alloc;
 extern uint32_t rephist_total_num;
+void dump_distinct_digests_xx(int severity); // xxxx0124 remove
 
 /**
  * Write current memory usage information to the log.
@@ -1436,6 +1437,7 @@
   rep_hist_dump_stats(now,severity);
   rend_service_dump_stats(severity);
   dump_pk_ops(severity);
+  dump_distinct_digests_xx(severity);
 }
 
 /** Called by exit() as we shut down the process.

Modified: tor/trunk/src/or/routerparse.c
===================================================================
--- tor/trunk/src/or/routerparse.c	2006-11-01 13:33:49 UTC (rev 8889)
+++ tor/trunk/src/or/routerparse.c	2006-11-01 18:16:44 UTC (rev 8890)
@@ -699,6 +699,17 @@
   return 0;
 }
 
+void dump_distinct_digests_xx(int severity);
+static digestmap_t *verified_digests_tmp = NULL; // XXXX0124 remove me.
+// remove me too.
+void
+dump_distinct_digests_xx(int severity) {
+  if (!verified_digests_tmp)
+    verified_digests_tmp = digestmap_new();
+  log(severity, LD_GENERAL, "%d *distinct* router digests verified",
+      digestmap_size(verified_digests_tmp));
+}
+
 /** Helper function: reads a single router entry from *<b>s</b> ...
  * *<b>end</b>.  Mallocs a new router and returns it if all goes well, else
  * returns NULL.
@@ -913,6 +924,9 @@
     goto err;
   }
   note_crypto_pk_op(VERIFY_RTR);
+  if (!verified_digests_tmp)
+    verified_digests_tmp = digestmap_new();
+  digestmap_set(verified_digests_tmp, signed_digest, (void*)(uintptr_t)1);
   if ((t=crypto_pk_public_checksig(router->identity_pkey, signed_digest,
                                    tok->object_body, 128)) != 20) {
     log_warn(LD_DIR, "Invalid signature %d",t);