diff options
author | Nick Mathewson <nickm@torproject.org> | 2017-04-11 15:47:21 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2017-04-24 10:59:25 -0400 |
commit | 82bb8afb6067005f52f656b658ca1a1a6501b22d (patch) | |
tree | 9ffaf8d959c6070e9322edba8d09e610627d9945 /src/or/conscache.c | |
parent | 5726fec9c22c53c77f67b26782de1803ff6cca49 (diff) | |
download | tor-82bb8afb6067005f52f656b658ca1a1a6501b22d.tar.gz tor-82bb8afb6067005f52f656b658ca1a1a6501b22d.zip |
Add handle support to consensus_cache_entry_t
This will allow us to have weak references to cache entries.
Diffstat (limited to 'src/or/conscache.c')
-rw-r--r-- | src/or/conscache.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/or/conscache.c b/src/or/conscache.c index a186163b6c..9dedb43085 100644 --- a/src/or/conscache.c +++ b/src/or/conscache.c @@ -16,6 +16,7 @@ */ 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. */ @@ -305,6 +306,7 @@ consensus_cache_entry_decref(consensus_cache_entry_t *ent) } 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); } @@ -490,6 +492,8 @@ consensus_cache_entry_unmap(consensus_cache_entry_t *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. |