From 899d7bc3a65da29109b3f52ec600202527a91935 Mon Sep 17 00:00:00 2001 From: MonsieurNicolas Date: Fri, 16 Mar 2018 14:13:26 -0700 Subject: [PATCH] don't connect to too many peers at once hardcoded for now at 50 peers per calls to `getPeersToConnectTo` --- src/overlay/OverlayManagerImpl.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/overlay/OverlayManagerImpl.cpp b/src/overlay/OverlayManagerImpl.cpp index a5946d85c6..e25f730570 100644 --- a/src/overlay/OverlayManagerImpl.cpp +++ b/src/overlay/OverlayManagerImpl.cpp @@ -231,7 +231,11 @@ OverlayManagerImpl::getPreferredPeersFromConfig() std::vector OverlayManagerImpl::getPeersToConnectTo(int maxNum) { - const int batchSize = std::max(20, maxNum); + // don't connect to too many peers at once + maxNum = std::min(maxNum, 50); + + // batch is how many peers to load from the database every time + const int batchSize = std::max(50, maxNum); std::vector peers;