From 17f3533c8484f02732fff5cf004d251c0df50eb8 Mon Sep 17 00:00:00 2001 From: Patrick Strateman Date: Fri, 21 Aug 2015 18:42:05 -0700 Subject: [PATCH] Better support for nodes with non-standard nMaxConnections --- src/net.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/net.cpp b/src/net.cpp index 709c65243..4d08f63e3 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -862,7 +862,7 @@ static bool AttemptToEvictConnection(bool fPreferNewConnection) { // Protect the 64 nodes which have been connected the longest. // This replicates the existing implicit behavior. std::sort(vEvictionCandidates.begin(), vEvictionCandidates.end(), ReverseCompareNodeTimeConnected); - vEvictionCandidates.erase(vEvictionCandidates.end() - std::min(64, static_cast(vEvictionCandidates.size())), vEvictionCandidates.end()); + vEvictionCandidates.erase(vEvictionCandidates.end() - std::min(static_cast(vEvictionCandidates.size() / 2), static_cast(vEvictionCandidates.size())), vEvictionCandidates.end()); if (vEvictionCandidates.empty()) return false;