From db6c30108491c3c548af9f9a92eb8da5553384c4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Adrien=20B=C3=A9raud?= <adrien.beraud@savoirfairelinux.com>
Date: Sun, 15 May 2016 01:28:09 -0400
Subject: [PATCH] dht: don't count bad nodes in get request count

---
 src/dht.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/dht.cpp b/src/dht.cpp
index 4aa6ec32..38b3c803 100644
--- a/src/dht.cpp
+++ b/src/dht.cpp
@@ -270,7 +270,7 @@ struct Dht::Search {
     unsigned currentGetRequests() const {
         unsigned count = 0;
         for (const auto& n : nodes)
-            if (n.getStatus and n.getStatus->pending())
+            if (not n.isBad() and n.getStatus and n.getStatus->pending())
                 count++;
         return count;
     }
@@ -887,6 +887,8 @@ Dht::searchStep(std::shared_ptr<Search> sr)
         }
     }
 
+    //dumpSearch(*sr, std::cout);
+
     /* periodic searchStep scheduling. */
     if (not sr->done)
         scheduler.edit(sr->nextSearchStep, sr->getNextStepTime(types, now));
-- 
GitLab