Browse Source

Better support for nodes with non-standard nMaxConnections

pull/4/head
Patrick Strateman 9 years ago
committed by Taylor Hornby
parent
commit
4dad09350f
  1. 2
      src/net.cpp

2
src/net.cpp

@ -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;

Loading…
Cancel
Save