[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] Make dropping very old descriptors faster (remove old corre...
Update of /home/or/cvsroot/tor/src/or
In directory moria:/tmp/cvs-serv15322/src/or
Modified Files:
routerlist.c
Log Message:
Make dropping very old descriptors faster (remove old correctness check). Track bytes dropped that are still in our store or journal, and rebuild when it gets very high.
Index: routerlist.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/routerlist.c,v
retrieving revision 1.378
retrieving revision 1.379
diff -u -d -r1.378 -r1.379
--- routerlist.c 23 Nov 2005 07:06:36 -0000 1.378
+++ routerlist.c 23 Nov 2005 07:24:59 -0000 1.379
@@ -143,6 +143,8 @@
static size_t router_journal_len = 0;
/** The size of the router store, in bytes. */
static size_t router_store_len = 0;
+/** Total bytes dropped since last rebuild. */
+static size_t router_bytes_dropped = 0;
/** Helper: return 1 iff the router log is so big we want to rebuild the
* store. */
@@ -150,7 +152,8 @@
router_should_rebuild_store(void)
{
if (router_store_len > (1<<16))
- return router_journal_len > router_store_len / 2;
+ return (router_journal_len > router_store_len / 2 ||
+ router_bytes_dropped > router_store_len / 2);
else
return router_journal_len > (1<<15);
}
@@ -239,6 +242,7 @@
r = 0;
router_store_len = len;
router_journal_len = 0;
+ router_bytes_dropped = 0;
done:
tor_free(fname);
if (chunk_list) {
@@ -1210,13 +1214,15 @@
ri_tmp = digestmap_remove(rl->identity_map, ri->cache_info.identity_digest);
tor_assert(ri_tmp == ri);
if (make_old && get_options()->DirPort) {
- signed_descriptor_t *sd = signed_descriptor_from_routerinfo(ri);
+ signed_descriptor_t *sd;
+ sd = signed_descriptor_from_routerinfo(ri);
smartlist_add(rl->old_routers, sd);
digestmap_set(rl->desc_digest_map, sd->signed_descriptor_digest, sd);
} else {
ri_tmp = digestmap_remove(rl->desc_digest_map,
ri->cache_info.signed_descriptor_digest);
tor_assert(ri_tmp == ri);
+ router_bytes_dropped += ri->cache_info.signed_descriptor_len;
routerinfo_free(ri);
}
// routerlist_assert_ok(rl);
@@ -1233,8 +1239,9 @@
sd_tmp = digestmap_remove(rl->desc_digest_map,
sd->signed_descriptor_digest);
tor_assert(sd_tmp == sd);
+ router_bytes_dropped += sd->signed_descriptor_len;
signed_descriptor_free(sd);
- routerlist_assert_ok(rl);
+ // routerlist_assert_ok(rl);
}
/** Remove <b>ri_old</b> from the routerlist <b>rl</b>, and replace it with