log_err("malloc failed");
return;
}
- slabhash_insert(subnet_msg_cache, h, lru_entry, lru_entry->data, NULL);
}
/** Step 2, find the correct tree */
if (!(tree = get_tree(lru_entry->data, edns, qstate->env))) {
edns->subnet_source_mask,
qstate->edns_server_in.subnet_scope_mask, rep, rep->ttl + *qstate->env->now,
*qstate->env->now);
- if (acquired_lock) lock_rw_unlock(&lru_entry->lock);
+ if (acquired_lock)
+ lock_rw_unlock(&lru_entry->lock);
+ slabhash_insert(subnet_msg_cache, h, lru_entry, lru_entry->data, NULL);
}
/* if so: update data - needs a writelock */
table->space_used += need_size -
(*table->sizefunc)(found->key, found->data);
- (*table->delkeyfunc)(entry->key, cb_arg);
+ if (found->key != entry->key) {
+ (*table->delkeyfunc)(entry->key, cb_arg);
+ }
lru_touch(table, found);
lock_rw_wrlock(&found->lock);
- (*table->deldatafunc)(found->data, cb_arg);
- found->data = data;
+ if (found->data != data) {
+ (*table->deldatafunc)(found->data, cb_arg);
+ found->data = data;
+ }
lock_rw_unlock(&found->lock);
}
lock_quick_unlock(&bin->lock);