aboutsummaryrefslogtreecommitdiff
path: root/src/or/microdesc.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2011-05-03 17:30:58 -0400
committerNick Mathewson <nickm@torproject.org>2011-05-03 17:30:58 -0400
commit599d1b62b4c98ad5fea1d0f3f5523c8dc53779e1 (patch)
tree2031716952ee01ba2fbec4f325606def7c2dcaab /src/or/microdesc.c
parent865d53be5484ef06ca4a5103d9ebca343e19f7d4 (diff)
parent68ae5afa5a172fbc485eda7e6bfd4750fa6a69f5 (diff)
downloadtor-599d1b62b4c98ad5fea1d0f3f5523c8dc53779e1.tar.gz
tor-599d1b62b4c98ad5fea1d0f3f5523c8dc53779e1.zip
Merge remote-tracking branch 'origin/maint-0.2.2'
Conflicts: src/or/main.c src/or/microdesc.c
Diffstat (limited to 'src/or/microdesc.c')
-rw-r--r--src/or/microdesc.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/or/microdesc.c b/src/or/microdesc.c
index 5d3f1c372a..6209bbf33e 100644
--- a/src/or/microdesc.c
+++ b/src/or/microdesc.c
@@ -245,8 +245,6 @@ microdescs_add_list_to_cache(microdesc_cache_t *cache,
if (f)
finish_writing_to_file(open_file); /*XXX Check me.*/
- microdesc_cache_rebuild(cache, 0/* only as needed */);
-
{
networkstatus_t *ns = networkstatus_get_latest_consensus();
if (ns && ns->flavor == FLAV_MICRODESC)
@@ -273,6 +271,7 @@ microdesc_cache_clear(microdesc_cache_t *cache)
}
cache->total_len_seen = 0;
cache->n_seen = 0;
+ cache->bytes_dropped = 0;
}
/** Reload the contents of <b>cache</b> from disk. If it is empty, load it
@@ -314,7 +313,7 @@ microdesc_cache_reload(microdesc_cache_t *cache)
log_notice(LD_DIR, "Reloaded microdescriptor cache. Found %d descriptors.",
total);
- microdesc_cache_clean(cache, 0, 0);
+ microdesc_cache_rebuild(cache, 0 /* don't force */);
return 0;
}
@@ -399,6 +398,12 @@ microdesc_cache_rebuild(microdesc_cache_t *cache, int force)
off_t off = 0;
int orig_size, new_size;
+ if (cache == NULL) {
+ cache = the_microdesc_cache;
+ if (cache == NULL)
+ return 0;
+ }
+
/* Remove dead descriptors */
microdesc_cache_clean(cache, 0/*cutoff*/, 0/*force*/);