diff options
author | Nick Mathewson <nickm@torproject.org> | 2006-11-30 22:23:01 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2006-11-30 22:23:01 +0000 |
commit | d1fdabf1c738873e805d4d7dd1772dc98666e18f (patch) | |
tree | e71fc6639ed20b0d65fbba56de71aa94851dc6a5 /src/or/routerparse.c | |
parent | 8e17ffa351afb8f906488a529d9d328d530af341 (diff) | |
download | tor-d1fdabf1c738873e805d4d7dd1772dc98666e18f.tar.gz tor-d1fdabf1c738873e805d4d7dd1772dc98666e18f.zip |
r9843@Kushana: nickm | 2006-11-30 17:22:25 -0500
Turn an xxxx0124 into an #ifdef; avoid leaking memory.
svn:r9013
Diffstat (limited to 'src/or/routerparse.c')
-rw-r--r-- | src/or/routerparse.c | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/src/or/routerparse.c b/src/or/routerparse.c index a592c3d0f9..2c3e0d84be 100644 --- a/src/or/routerparse.c +++ b/src/or/routerparse.c @@ -699,16 +699,25 @@ router_parse_list_from_string(const char **s, smartlist_t *dest, 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 @@ router_parse_entry_from_string(const char *s, const char *end, 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); |