diff --git a/include/opendht/dht.h b/include/opendht/dht.h index 1375d9c7..3d32e946 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, time_point created=time_point::max()); + ValueStorage* storageStore(const InfoHash& id, const std::shared_ptr& value, time_point created); void expireStorage(); void storageChanged(Storage& st, ValueStorage&); diff --git a/src/dht.cpp b/src/dht.cpp index 3abec427..86972b7d 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& import) DHT_DEBUG("Discarding expired value at %s", h.first.toString().c_str()); continue; } - auto st = storageStore(h.first, std::make_shared(std::move(tmp_val))); + auto st = storageStore(h.first, std::make_shared(std::move(tmp_val)), val_time); st->time = val_time; } } catch (const std::exception&) {