Better support for nodes with non-standard nMaxConnections

This commit is contained in:
Patrick Strateman 2015-08-21 18:42:05 -07:00 committed by Taylor Hornby
parent 6e966f67fd
commit 4dad09350f
1 changed files with 1 additions and 1 deletions

View File

@ -758,7 +758,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<int>(vEvictionCandidates.size())), vEvictionCandidates.end());
vEvictionCandidates.erase(vEvictionCandidates.end() - std::min(static_cast<int>(vEvictionCandidates.size() / 2), static_cast<int>(vEvictionCandidates.size())), vEvictionCandidates.end());
if (vEvictionCandidates.empty())
return false;