]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
lib/generic: fixed typo in lru code
authorMarek Vavrusa <marek@vavrusa.com>
Wed, 10 Aug 2016 03:30:59 +0000 (20:30 -0700)
committerMarek Vavrusa <marek@vavrusa.com>
Wed, 10 Aug 2016 03:30:59 +0000 (20:30 -0700)
this caused a bug in pseudo-lru table that negated
stickiness of values to table slots

lib/generic/lru.h

index 11abe016bc905033c02fe3b57d0a78b9dc46cbfe..8622c96f76bd9f0b7ea00ae40d4a7e3932c8d077 100644 (file)
@@ -166,7 +166,7 @@ static inline void *lru_slot_set(struct lru_hash_base *lru, const char *key, uin
        uint32_t id = hash(key, len) % lru->size;
        struct lru_slot *slot = lru_slot_at(lru, id);
        if (lru_slot_match(slot, key, len)) {
-               slot->refs = 1; /* Increase slot significance */
+               slot->refs += 1; /* Increase slot significance */
        } else {
                if (slot->key) {
                        slot->refs -= 1; /* Decrease slot significance */