dht: fix value edition, add unit test

This commit is contained in:
Adrien Béraud committed 2023-01-27 17:31:59 -05:00
1 parent b1009a54e3
commit e6971c196b
5 files changed
+56 -9

No files matched your search

+6
View File
@@ -28,6 +28,12 @@ OpValueCache::onValuesAdded(const std::vector<Sp<Value>>& vals, const system_clo
auto viop = values.emplace(v->id, v);
if (viop.second) {
newValues.emplace_back(v);
} else if (*viop.first->second.data != *v) {
// Special case for edition
if (v->seq > viop.first->second.data->seq) {
viop.first->second.data = v;
newValues.emplace_back(v);
}
} else {
viop.first->second.refCount++;
}