aboutsummaryrefslogtreecommitdiff
path: root/src/or/main.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2007-12-01 22:38:58 +0000
committerRoger Dingledine <arma@torproject.org>2007-12-01 22:38:58 +0000
commit9b1b8199dfbf16519d1e18d49f80f253db687064 (patch)
tree31753b3ae66bfd97f81469364c4e3aa33551bc17 /src/or/main.c
parent77e607cc0d99bb06fadc96d127681473f9d1b2eb (diff)
downloadtor-9b1b8199dfbf16519d1e18d49f80f253db687064.tar
tor-9b1b8199dfbf16519d1e18d49f80f253db687064.tar.gz
backport candidate:
Start purging old entries from the "rephist" database, and the hidden service descriptor databases, even when DirPort is zero. svn:r12628
Diffstat (limited to 'src/or/main.c')
-rw-r--r--src/or/main.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/or/main.c b/src/or/main.c
index a89bfc599..acb7cac3f 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -833,6 +833,8 @@ run_scheduled_events(time_t now)
static time_t time_to_downrate_stability = 0;
#define SAVE_STABILITY_INTERVAL (30*60)
static time_t time_to_save_stability = 0;
+#define CLEAN_CACHES_INTERVAL (30*60)
+ static time_t time_to_clean_caches = 0;
or_options_t *options = get_options();
int i;
int have_dir_info;
@@ -974,12 +976,14 @@ run_scheduled_events(time_t now)
#define V1_RUNNINGROUTERS_FETCH_PERIOD (12*60*60)
time_to_fetch_running_routers = now + V1_RUNNINGROUTERS_FETCH_PERIOD;
- /* Also, take this chance to remove old information from rephist
- * and the rend cache. */
+ }
+
+ /* Remove old information from rephist and the rend cache. */
+ if (time_to_clean_caches < now) {
rep_history_clean(now - options->RephistTrackTime);
rend_cache_clean();
rend_cache_clean_v2_descs_as_dir();
- /* XXX020 we only clean this stuff if DirPort is set?! -RD */
+ time_to_clean_caches = now + CLEAN_CACHES_INTERVAL;
}
/* 2b. Once per minute, regenerate and upload the descriptor if the old