aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2007-12-01 23:34:43 +0000
committerRoger Dingledine <arma@torproject.org>2007-12-01 23:34:43 +0000
commit47f011cac8de7fd5e43f0619520957fd09978fd6 (patch)
treecfe1830a738d5d843210e132ca1ee5ade77a2cd4
parent9df8eec60e8daa87b87b2cae3d55cede4b2081db (diff)
downloadtor-47f011cac8de7fd5e43f0619520957fd09978fd6.tar.gz
tor-47f011cac8de7fd5e43f0619520957fd09978fd6.zip
backport r12628
svn:r12629
-rw-r--r--ChangeLog2
-rw-r--r--src/or/main.c10
2 files changed, 9 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 4fe3a76341..83e0af4aae 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -11,6 +11,8 @@ Changes in version 0.1.2.19 - 2007-??-??
buckets to become negative. Fixes Bug 544.
- Fix a memory leak on exit relays; we were leaking a cached_resolve_t
on every successful resolve. Reported by Mike Perry.
+ - Purge old entries from the "rephist" database and the hidden
+ service descriptor database even when DirPort is zero.
o Minor bugfixes:
- Changing the ExitPolicyRejectPrivate setting should cause us to
diff --git a/src/or/main.c b/src/or/main.c
index 1c6e3bd1c6..c7ff34c380 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -747,6 +747,8 @@ run_scheduled_events(time_t now)
static time_t time_to_try_getting_descriptors = 0;
static time_t time_to_reset_descriptor_failures = 0;
static time_t time_to_add_entropy = 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;
@@ -854,12 +856,14 @@ run_scheduled_events(time_t now)
/** How often do we (as a cache) fetch a new V1 runningrouters document? */
#define V1_RUNNINGROUTERS_FETCH_PERIOD (30*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();
- }
+ time_to_clean_caches = now + CLEAN_CACHES_INTERVAL;
+ }
/* 2b. Once per minute, regenerate and upload the descriptor if the old
* one is inaccurate. */