BUG/MINOR: peers: Missing TX cache entries reset.

The TX part of a cache for a dictionary is made of an reserved array of ebtree nodes
which are pointers to dictionary entries. So when we flush the TX part of such a
cache, we must not only remove these nodes to dictionary entries from their ebtree.
We must also reset their values. Furthermore, the LRU key and the last lookup
result must also be reset.
This commit is contained in:
Frdric Lcaille 2020-11-12 21:01:54 +01:00 committed by Willy Tarreau
parent f9e51beec1
commit ea875e62e6

View File

@ -3062,8 +3062,12 @@ static inline void flush_dcache(struct peer *peer)
int i; int i;
struct dcache *dc = peer->dcache; struct dcache *dc = peer->dcache;
for (i = 0; i < dc->max_entries; i++) for (i = 0; i < dc->max_entries; i++) {
ebpt_delete(&dc->tx->entries[i]); ebpt_delete(&dc->tx->entries[i]);
dc->tx->entries[i].key = NULL;
}
dc->tx->prev_lookup = NULL;
dc->tx->lru_key = 0;
memset(dc->rx, 0, dc->max_entries * sizeof *dc->rx); memset(dc->rx, 0, dc->max_entries * sizeof *dc->rx);
} }