aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2011-05-03 16:33:41 -0400
committerNick Mathewson <nickm@torproject.org>2011-05-03 16:33:41 -0400
commit1f97e8322fe040066c630073a71a59ff0c161beb (patch)
tree6acb3e0dd92c96937e03052ec38a755f49608e31
parent5b96773a40fb1290e3198c0f01d11b2fc0fe74bd (diff)
parent970715dd8f52a79bbaddfcfa5af1f11608ddacf9 (diff)
downloadtor-1f97e8322fe040066c630073a71a59ff0c161beb.tar
tor-1f97e8322fe040066c630073a71a59ff0c161beb.tar.gz
Merge remote-tracking branch 'origin/maint-0.2.2'
Conflicts: src/or/microdesc.c
-rw-r--r--changes/bug2230_part17
-rw-r--r--changes/bug2230_part25
-rw-r--r--src/or/microdesc.c6
3 files changed, 16 insertions, 2 deletions
diff --git a/changes/bug2230_part1 b/changes/bug2230_part1
new file mode 100644
index 000000000..79f725410
--- /dev/null
+++ b/changes/bug2230_part1
@@ -0,0 +1,7 @@
+ o Minor bugfixes
+ - When loading the microdesc journal, remember its current size.
+ In 0.2.2, this helps prevent the microdesc journal from growing
+ without limit on authorities (who are the only ones to use it in
+ 0.2.2). Fixes a part of bug 2230; bugfix on 0.2.2.6-alpha.
+ Fix posted by "cypherpunks."
+
diff --git a/changes/bug2230_part2 b/changes/bug2230_part2
new file mode 100644
index 000000000..2664ecc1a
--- /dev/null
+++ b/changes/bug2230_part2
@@ -0,0 +1,5 @@
+ o Minor bugfixes
+ - The microdesc journal is supposed to get rebuilt only if it is
+ at least _half_ the length of the store, not _twice_ the length
+ of the store. Bugfix on 0.2.2.6-alpha; fixes part of bug 2230.
+
diff --git a/src/or/microdesc.c b/src/or/microdesc.c
index 469c2fcad..521ee0709 100644
--- a/src/or/microdesc.c
+++ b/src/or/microdesc.c
@@ -246,9 +246,10 @@ microdescs_add_list_to_cache(microdesc_cache_t *cache,
{
size_t old_content_len =
cache->cache_content ? cache->cache_content->size : 0;
- if ((cache->journal_len > 16384 + old_content_len &&
- cache->journal_len > old_content_len / 2))
+ if (cache->journal_len > 16384 + old_content_len &&
+ cache->journal_len > old_content_len / 2) {
microdesc_cache_rebuild(cache);
+ }
}
{
@@ -305,6 +306,7 @@ microdesc_cache_reload(microdesc_cache_t *cache)
journal_content = read_file_to_str(cache->journal_fname,
RFTS_IGNORE_MISSING, &st);
if (journal_content) {
+ cache->journal_len = (size_t) st.st_size;
added = microdescs_add_to_cache(cache, journal_content,
journal_content+st.st_size,
SAVED_IN_JOURNAL, 0, -1, NULL);