From 096771ec33f4b3c93240ad194978b79749a2160b Mon Sep 17 00:00:00 2001 From: kaldoran <kaldoran@live.fr> Date: Mon, 8 Aug 2016 17:45:10 -0400 Subject: [PATCH] dht: Fix get and put at the same time on a same node When the put is performed just after a get, then the get will not include the value which was in the put. --- src/dht.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/dht.cpp b/src/dht.cpp index 7ae0bc42..982a089a 100644 --- a/src/dht.cpp +++ b/src/dht.cpp @@ -841,7 +841,7 @@ Dht::searchStep(std::shared_ptr<Search> sr) continue; } } - if (in) storageStore(sr->id, a.value, a.created); + unsigned i = 0; for (auto& n : sr->nodes) { if (not n.isSynced(now)) @@ -1244,6 +1244,8 @@ Dht::announce(const InfoHash& id, sa_family_t af, std::shared_ptr<Value> value, return; } + storageStore(id, value, created); + auto& srs = af == AF_INET ? searches4 : searches6; auto srp = srs.find(id); auto sr = srp == srs.end() ? search(id, af, nullptr, nullptr) : srp->second; -- GitLab