From 68707aff17c2eeb9e883adbd722c53056b0e35df Mon Sep 17 00:00:00 2001 From: Nicolas <kaldoran@users.noreply.github.com> Date: Thu, 28 Jul 2016 16:58:04 -0400 Subject: [PATCH] dht: prevent outdated store of value --- src/dht.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/dht.cpp b/src/dht.cpp index 0862224d..eb613a4d 100644 --- a/src/dht.cpp +++ b/src/dht.cpp @@ -1837,6 +1837,10 @@ Dht::storageStore(const InfoHash& id, const std::shared_ptr<Value>& value, time_ { const auto& now = scheduler.time(); created = std::min(created, now); + + if ( created + getType(value->id).expiration < clock::now() ) + return false; + auto st = findStorage(id); if (st == store.end()) { if (store.size() >= MAX_HASHES) -- GitLab