mirror of
https://github.com/savoirfairelinux/opendht.git
synced 2026-11-08 04:21:51 +00:00
dht: preserve value creation time
This commit is contained in:
1 parent
04aa3d3dba
commit
328a61df00
2 files changed
+3
-3
No files matched your search
@@ -882,7 +882,7 @@ private:
|
||||
}
|
||||
|
||||
void storageAddListener(const InfoHash& id, const InfoHash& node, const sockaddr *from, socklen_t fromlen, uint16_t tid);
|
||||
ValueStorage* storageStore(const InfoHash& id, const std::shared_ptr<Value>& value, time_point created=time_point::max());
|
||||
ValueStorage* storageStore(const InfoHash& id, const std::shared_ptr<Value>& value, time_point created);
|
||||
void expireStorage();
|
||||
void storageChanged(Storage& st, ValueStorage&);
|
||||
|
||||
|
||||
+2
-2
@@ -984,7 +984,7 @@ Dht::searchStep(Search& sr)
|
||||
if (in) {
|
||||
DHT_WARN("[search %s IPv%c] [value %lu] storing locally",
|
||||
sr.id.toString().c_str(), sr.af == AF_INET ? '4' : '6', vid);
|
||||
storageStore(sr.id, a.value);
|
||||
storageStore(sr.id, a.value, a.created);
|
||||
}
|
||||
for (auto& n : sr.nodes) {
|
||||
if (not n.isSynced(now) or (n.candidate and t >= TARGET_NODES))
|
||||
@@ -2807,7 +2807,7 @@ Dht::importValues(const std::vector<ValuesExport>& import)
|
||||
DHT_DEBUG("Discarding expired value at %s", h.first.toString().c_str());
|
||||
continue;
|
||||
}
|
||||
auto st = storageStore(h.first, std::make_shared<Value>(std::move(tmp_val)));
|
||||
auto st = storageStore(h.first, std::make_shared<Value>(std::move(tmp_val)), val_time);
|
||||
st->time = val_time;
|
||||
}
|
||||
} catch (const std::exception&) {
|
||||
|
||||
Reference in new issue
Block a user