Skip to content

Commit

Permalink
Better support for nodes with non-standard nMaxConnections
Browse files Browse the repository at this point in the history
  • Loading branch information
pstratem authored and Fuzzbawls committed Jun 23, 2020
1 parent 9c9e55b commit 85886c9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -976,7 +976,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;
Expand Down

0 comments on commit 85886c9

Please sign in to comment.