diff options
Diffstat (limited to 'src/or/conscache.c')
-rw-r--r-- | src/or/conscache.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/or/conscache.c b/src/or/conscache.c index 2a6e1445e3..a186163b6c 100644 --- a/src/or/conscache.c +++ b/src/or/conscache.c @@ -174,6 +174,8 @@ consensus_cache_find_first(consensus_cache_t *cache, * Given a <b>cache</b>, add every entry to <b>out<b> for which * <b>key</b>=<b>value</b>. If <b>key</b> is NULL, add every entry. * + * Do not add any entry that has been marked for removal. + * * Does not adjust reference counts. */ void @@ -182,12 +184,15 @@ consensus_cache_find_all(smartlist_t *out, const char *key, const char *value) { - if (! key) { - smartlist_add_all(out, cache->entries); - return; - } - SMARTLIST_FOREACH_BEGIN(cache->entries, consensus_cache_entry_t *, ent) { + if (ent->can_remove == 1) { + /* We want to delete this; pretend it isn't there. */ + continue; + } + if (! key) { + smartlist_add(out, ent); + continue; + } const char *found_val = consensus_cache_entry_get_value(ent, key); if (found_val && !strcmp(value, found_val)) { smartlist_add(out, ent); |