p2p: pass maxConns for MaxPeers during node setup (#8684) (#8692)

* pass maxConns for MaxPeers
* add upgrade connections to max connections for max peers
* change the formula to calculate max peers

(cherry picked from commit 30929cf190)

Co-authored-by: Evan Forbes <42654277+evan-forbes@users.noreply.github.com>
This commit is contained in:
mergify[bot]
2022-06-04 08:53:41 -07:00
committed by GitHub
parent 3079eb8b30
commit 98411962c6

View File

@@ -492,11 +492,13 @@ func createPeerManager(
privatePeerIDs[types.NodeID(id)] = struct{}{}
}
const maxUpgradeConns = 4
options := p2p.PeerManagerOptions{
SelfAddress: selfAddr,
MaxConnected: maxConns,
MaxConnectedUpgrade: 4,
MaxPeers: 1000,
MaxConnectedUpgrade: maxUpgradeConns,
MaxPeers: maxUpgradeConns + 2*maxConns,
MinRetryTime: 250 * time.Millisecond,
MaxRetryTime: 30 * time.Minute,
MaxRetryTimePersistent: 5 * time.Minute,