Skip to content

Commit

Permalink
Set maxConnections in libp2p's connection manager
Browse files Browse the repository at this point in the history
  • Loading branch information
twoeths committed Jan 14, 2023
1 parent 14c540d commit a29edf4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/beacon-node/src/network/nodejs/bundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,11 @@ export async function createNodejsLibp2p(options: ILibp2pOptions): Promise<Libp2
dialTimeout: 30_000,

autoDial: false,
// This is the default value, we reject connections based on tcp() option above so this is not important
maxConnections: Infinity,
// DOCS: the maximum number of connections libp2p is willing to have before it starts disconnecting.
// If ConnectionManager.size > maxConnections calls _maybeDisconnectOne() which will sort peers disconnect
// the one with the least `_peerValues`. That's a custom peer generalized score that's not used, so it always
// has the same value in current Lodestar usage.
maxConnections: options.maxConnections,
// DOCS: the minimum number of connections below which libp2p not activate preemptive disconnections.
// If ConnectionManager.size < minConnections, it won't prune peers in _maybeDisconnectOne(). If autoDial is
// off it doesn't have any effect in behaviour.
Expand Down

0 comments on commit a29edf4

Please sign in to comment.