summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2008-03-29 04:27:34 +0000
committerNick Mathewson <nickm@torproject.org>2008-03-29 04:27:34 +0000
commite19d96637d44bef2751e7c6c594a2951fcdc1b0a (patch)
treed9b7d645a40f508bf611798ed5a672c28a7996e4
parente89bf1c573e250bb13847ded09d921d5ad60a461 (diff)
downloadtor-e19d96637d44bef2751e7c6c594a2951fcdc1b0a.tar.gz
tor-e19d96637d44bef2751e7c6c594a2951fcdc1b0a.zip
r19118@catbus: nickm | 2008-03-29 00:27:08 -0400
Code (disabled) to get way too much info about the contents of old_routers on USR1. svn:r14230
-rw-r--r--src/or/dirserv.c3
-rw-r--r--src/or/or.h2
-rw-r--r--src/or/routerlist.c34
3 files changed, 37 insertions, 2 deletions
diff --git a/src/or/dirserv.c b/src/or/dirserv.c
index 81181f7741..aa4d8b717e 100644
--- a/src/or/dirserv.c
+++ b/src/or/dirserv.c
@@ -2939,6 +2939,7 @@ connection_dirserv_finish_spooling(dir_connection_t *conn)
static int
connection_dirserv_add_servers_to_outbuf(dir_connection_t *conn)
{
+ time_t now = time(NULL);
int by_fp = (conn->dir_spool_src == DIR_SPOOL_SERVER_BY_FP ||
conn->dir_spool_src == DIR_SPOOL_EXTRA_BY_FP);
int extra = (conn->dir_spool_src == DIR_SPOOL_EXTRA_BY_FP ||
@@ -2966,7 +2967,7 @@ connection_dirserv_add_servers_to_outbuf(dir_connection_t *conn)
* unknown bridge descriptor has shown up between then and now. */
continue;
}
-
+ sd->last_served_at = now;
body = signed_descriptor_get_body(sd);
if (conn->zlib_state) {
int last = ! smartlist_len(conn->fingerprint_stack);
diff --git a/src/or/or.h b/src/or/or.h
index a21384b9c5..e4766ba145 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -1221,6 +1221,8 @@ typedef struct signed_descriptor_t {
/** The valid-until time of the most recent consensus that listed this
* descriptor. 0 for "never listed in a consensus, so far as we know." */
time_t last_listed_as_valid_until;
+ /** DOCDOC */
+ time_t last_served_at; /*XXXX021 remove if not useful. */
/* If true, we do not ever try to save this object in the cache. */
unsigned int do_not_cache : 1;
/* If true, this item is meant to represent an extrainfo. */
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index b6889e9eaa..c7c701bae3 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -2247,11 +2247,43 @@ dump_routerlist_mem_usage(int severity)
SMARTLIST_FOREACH(routerlist->old_routers, signed_descriptor_t *, sd,
olddescs += sd->signed_descriptor_len);
- log(severity, LD_GENERAL,
+ log(severity, LD_DIR,
"In %d live descriptors: "U64_FORMAT" bytes. "
"In %d old descriptors: "U64_FORMAT" bytes.",
smartlist_len(routerlist->routers), U64_PRINTF_ARG(livedescs),
smartlist_len(routerlist->old_routers), U64_PRINTF_ARG(olddescs));
+
+#if 0
+ {
+ const smartlist_t *networkstatus_v2_list = networkstatus_get_v2_list();
+ networkstatus_t *consensus = networkstatus_get_latest_consensus();
+ log(severity, LD_DIR, "Now let's look through old_descriptors!");
+ SMARTLIST_FOREACH(routerlist->old_routers, signed_descriptor_t *, sd, {
+ int in_v2 = 0;
+ int in_v3 = 0;
+ char published[ISO_TIME_LEN+1];
+ char last_valid_until[ISO_TIME_LEN+1];
+ char last_served_at[ISO_TIME_LEN+1];
+ char id[HEX_DIGEST_LEN+1];
+ format_iso_time(published, sd->published_on);
+ format_iso_time(last_valid_until, sd->last_listed_as_valid_until);
+ format_iso_time(last_served_at, sd->last_served_at);
+ base16_encode(id, sizeof(id), sd->identity_digest, DIGEST_LEN);
+ SMARTLIST_FOREACH(networkstatus_v2_list, networkstatus_v2_t *, ns,
+ if (networkstatus_v2_find_entry(ns, sd->identity_digest)) {
+ in_v2 = 1; break;
+ });
+ if (consensus && networkstatus_vote_find_entry(consensus,
+ sd->identity_digest))
+ in_v3 = 1;
+ log(severity, LD_DIR,
+ "Old descriptor for %s (published %s) %sin v2 ns, %sin v3 "
+ "consensus. Last valid until %s; last served at %s.",
+ id, published, in_v2 ? "" : "not ", in_v3 ? "" : "not ",
+ last_valid_until, last_served_at);
+ });
+ }
+#endif
}
static INLINE int