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

[or-cvs] r12629: backport r12628 (in tor/branches/tor-0_1_2-patches: . src/or)



Author: arma
Date: 2007-12-01 18:34:43 -0500 (Sat, 01 Dec 2007)
New Revision: 12629

Modified:
   tor/branches/tor-0_1_2-patches/ChangeLog
   tor/branches/tor-0_1_2-patches/src/or/main.c
Log:
backport r12628


Modified: tor/branches/tor-0_1_2-patches/ChangeLog
===================================================================
--- tor/branches/tor-0_1_2-patches/ChangeLog	2007-12-01 22:38:58 UTC (rev 12628)
+++ tor/branches/tor-0_1_2-patches/ChangeLog	2007-12-01 23:34:43 UTC (rev 12629)
@@ -11,6 +11,8 @@
       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

Modified: tor/branches/tor-0_1_2-patches/src/or/main.c
===================================================================
--- tor/branches/tor-0_1_2-patches/src/or/main.c	2007-12-01 22:38:58 UTC (rev 12628)
+++ tor/branches/tor-0_1_2-patches/src/or/main.c	2007-12-01 23:34:43 UTC (rev 12629)
@@ -747,6 +747,8 @@
   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 @@
 /** 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. */