diff --git a/include/opendht/dht.h b/include/opendht/dht.h index 1375d9c7ab339b29b99eae6332a50d3c432a5f80..3d32e946df585c77a36a625e7588270abeab8b89 100644 --- a/include/opendht/dht.h +++ b/include/opendht/dht.h @@ -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&); diff --git a/src/dht.cpp b/src/dht.cpp index 3abec42718a9cd8c5b022640528d905d6b7c96a7..86972b7d6e1319cc2e5cada1529e123f45ca426e 100644 --- a/src/dht.cpp +++ b/src/dht.cpp @@ -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&) {