*/
struct consensus_cache_entry_t {
uint32_t magic; /**< Must be set to CCE_MAGIC */
+ HANDLE_ENTRY(consensus_cache_entry, consensus_cache_entry_t);
int32_t refcnt; /**< Reference count. */
unsigned can_remove : 1; /**< If true, we want to delete this file. */
/** If true, we intend to unmap this file as soon as we're done with it. */
}
tor_free(ent->fname);
config_free_lines(ent->labels);
+ consensus_cache_entry_handles_clear(ent);
memwipe(ent, 0, sizeof(consensus_cache_entry_t));
tor_free(ent);
}
ent->unused_since = TIME_MAX;
}
+HANDLE_IMPL(consensus_cache_entry, consensus_cache_entry_t, )
+
#ifdef TOR_UNIT_TESTS
/**
* Testing only: Return true iff <b>ent</b> is mapped into memory.
#ifndef TOR_CONSCACHE_H
#define TOR_CONSCACHE_H
+#include "handles.h"
+
typedef struct consensus_cache_entry_t consensus_cache_entry_t;
typedef struct consensus_cache_t consensus_cache_t;
+HANDLE_DECL(consensus_cache_entry, consensus_cache_entry_t, )
+
consensus_cache_t *consensus_cache_open(const char *subdir, int max_entries);
void consensus_cache_free(consensus_cache_t *cache);
void consensus_cache_unmap_lazy(consensus_cache_t *cache, time_t cutoff);