[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r9013: Turn an xxxx0124 into an #ifdef; avoid leaking memory. (in tor/trunk: . src/or)
- To: or-cvs@xxxxxxxxxxxxx
- Subject: [or-cvs] r9013: Turn an xxxx0124 into an #ifdef; avoid leaking memory. (in tor/trunk: . src/or)
- From: nickm@xxxxxxxx
- Date: Thu, 30 Nov 2006 17:23:01 -0500 (EST)
- Delivered-to: archiver@seul.org
- Delivered-to: or-cvs-outgoing@seul.org
- Delivered-to: or-cvs@seul.org
- Delivery-date: Thu, 30 Nov 2006 17:23:10 -0500
- Reply-to: or-talk@xxxxxxxxxxxxx
- Sender: owner-or-cvs@xxxxxxxxxxxxx
Author: nickm
Date: 2006-11-30 17:23:01 -0500 (Thu, 30 Nov 2006)
New Revision: 9013
Modified:
tor/trunk/
tor/trunk/src/or/main.c
tor/trunk/src/or/or.h
tor/trunk/src/or/routerparse.c
Log:
r9843@Kushana: nickm | 2006-11-30 17:22:25 -0500
Turn an xxxx0124 into an #ifdef; avoid leaking memory.
Property changes on: tor/trunk
___________________________________________________________________
svk:merge ticket from /tor/trunk [r9843] on c95137ef-5f19-0410-b913-86e773d04f59
Modified: tor/trunk/src/or/main.c
===================================================================
--- tor/trunk/src/or/main.c 2006-11-30 17:29:20 UTC (rev 9012)
+++ tor/trunk/src/or/main.c 2006-11-30 22:23:01 UTC (rev 9013)
@@ -1333,8 +1333,6 @@
extern uint64_t buf_total_alloc;
extern uint64_t rephist_total_alloc;
extern uint32_t rephist_total_num;
-// xxxx0124 remove
-void dump_distinct_digests_xx(int severity);
/**
* Write current memory usage information to the log.
@@ -1438,7 +1436,7 @@
rep_hist_dump_stats(now,severity);
rend_service_dump_stats(severity);
dump_pk_ops(severity);
- dump_distinct_digests_xx(severity);
+ dump_distinct_digest_count(severity);
}
/** Called by exit() as we shut down the process.
Modified: tor/trunk/src/or/or.h
===================================================================
--- tor/trunk/src/or/or.h 2006-11-30 17:29:20 UTC (rev 9012)
+++ tor/trunk/src/or/or.h 2006-11-30 22:23:01 UTC (rev 9013)
@@ -2783,6 +2783,7 @@
int tor_version_compare(tor_version_t *a, tor_version_t *b);
void sort_version_list(smartlist_t *lst, int remove_duplicates);
void assert_addr_policy_ok(addr_policy_t *t);
+void dump_distinct_digest_count(int severity);
networkstatus_t *networkstatus_parse_from_string(const char *s);
Modified: tor/trunk/src/or/routerparse.c
===================================================================
--- tor/trunk/src/or/routerparse.c 2006-11-30 17:29:20 UTC (rev 9012)
+++ tor/trunk/src/or/routerparse.c 2006-11-30 22:23:01 UTC (rev 9013)
@@ -699,16 +699,25 @@
return 0;
}
-void dump_distinct_digests_xx(int severity);
-static digestmap_t *verified_digests_tmp = NULL; // XXXX0124 remove me.
-// remove me too.
+/* For debugging: define to count every descriptor digest we've seen so we
+ * know if we need to try harder to avoid duplicate verifies. */
+#undef COUNT_DISTINCT_DIGESTS
+
+#ifdef COUNT_DISTINCT_DIGESTS
+static digestmap_t *verified_digests = NULL;
+#endif
+
void
-dump_distinct_digests_xx(int severity)
+dump_distinct_digest_count(int severity)
{
- if (!verified_digests_tmp)
- verified_digests_tmp = digestmap_new();
+#ifdef COUNT_DISTINCT_DIGESTS
+ if (!verified_digests)
+ verified_digests = digestmap_new();
log(severity, LD_GENERAL, "%d *distinct* router digests verified",
- digestmap_size(verified_digests_tmp));
+ digestmap_size(verified_digests));
+#else
+ (void)severity; /* suppress "unused parameter" warning */
+#endif
}
/** Helper function: reads a single router entry from *<b>s</b> ...
@@ -925,9 +934,11 @@
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);
+#ifdef COUNT_DISTINCT_DIGESTS
+ if (!verified_digests)
+ verified_digests = digestmap_new();
+ digestmap_set(verified_digests, signed_digest, (void*)(uintptr_t)1);
+#endif
if ((t=crypto_pk_public_checksig(router->identity_pkey, signed_digest,
tok->object_body, 128)) != 20) {
log_warn(LD_DIR, "Invalid signature %d",t);