[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r12628: backport candidate: Start purging old entries from the "reph (in tor/trunk: . src/or)



Author: arma
Date: 2007-12-01 17:38:58 -0500 (Sat, 01 Dec 2007)
New Revision: 12628

Modified:
   tor/trunk/ChangeLog
   tor/trunk/src/or/main.c
Log:
backport candidate:
Start purging old entries from the "rephist" database, and the
hidden service descriptor databases, even when DirPort is zero.


Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog	2007-12-01 20:04:36 UTC (rev 12627)
+++ tor/trunk/ChangeLog	2007-12-01 22:38:58 UTC (rev 12628)
@@ -5,6 +5,8 @@
       two new guards on startup (bugfix on 0.2.0.9-alpha), and it was
       causing us to discard all our guards on startup if we hadn't been
       running for a few weeks (bugfix on 0.1.2.x). Fixes bug 448.
+    - Start purging old entries from the "rephist" database, and the
+      hidden service descriptor databases, even when DirPort is zero.
 
   o Minor bugfixes:
     - The fix in 0.2.0.12-alpha cleared the "hsdir" flag in v3 network

Modified: tor/trunk/src/or/main.c
===================================================================
--- tor/trunk/src/or/main.c	2007-12-01 20:04:36 UTC (rev 12627)
+++ tor/trunk/src/or/main.c	2007-12-01 22:38:58 UTC (rev 12628)
@@ -833,6 +833,8 @@
   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 @@
 #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