aboutsummaryrefslogtreecommitdiff
path: root/src/or/rendcommon.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2011-02-07 06:39:21 -0500
committerRoger Dingledine <arma@torproject.org>2011-02-07 06:39:21 -0500
commitd3836b02cc579cd1c63d1b3fca57521c5a63beb2 (patch)
treefb3f5d624f8c94471269bf44ae0570296346eb2f /src/or/rendcommon.c
parent69f7c0385b16acdfa4a38cb36c86aaceebf61301 (diff)
downloadtor-d3836b02cc579cd1c63d1b3fca57521c5a63beb2.tar.gz
tor-d3836b02cc579cd1c63d1b3fca57521c5a63beb2.zip
change APIs slightly to make #1944 easier
Diffstat (limited to 'src/or/rendcommon.c')
-rw-r--r--src/or/rendcommon.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/or/rendcommon.c b/src/or/rendcommon.c
index 290e8f8389..aac660ab67 100644
--- a/src/or/rendcommon.c
+++ b/src/or/rendcommon.c
@@ -814,14 +814,13 @@ rend_cache_free_all(void)
/** Removes all old entries from the service descriptor cache.
*/
void
-rend_cache_clean(void)
+rend_cache_clean(time_t now)
{
strmap_iter_t *iter;
const char *key;
void *val;
rend_cache_entry_t *ent;
- time_t cutoff;
- cutoff = time(NULL) - REND_CACHE_MAX_AGE - REND_CACHE_MAX_SKEW;
+ time_t cutoff = now - REND_CACHE_MAX_AGE - REND_CACHE_MAX_SKEW;
for (iter = strmap_iter_init(rend_cache); !strmap_iter_done(iter); ) {
strmap_iter_get(iter, &key, &val);
ent = (rend_cache_entry_t*)val;
@@ -837,10 +836,10 @@ rend_cache_clean(void)
/** Remove all old v2 descriptors and those for which this hidden service
* directory is not responsible for any more. */
void
-rend_cache_clean_v2_descs_as_dir(void)
+rend_cache_clean_v2_descs_as_dir(time_t now)
{
digestmap_iter_t *iter;
- time_t cutoff = time(NULL) - REND_CACHE_MAX_AGE - REND_CACHE_MAX_SKEW;
+ time_t cutoff = now - REND_CACHE_MAX_AGE - REND_CACHE_MAX_SKEW;
for (iter = digestmap_iter_init(rend_cache_v2_dir);
!digestmap_iter_done(iter); ) {
const char *key;