Skip to content

Commit

Permalink
feat: add getMaxConnections method to connection manager (#2877)
Browse files Browse the repository at this point in the history
Adds a method to expose the max connections config setting.
  • Loading branch information
achingbrain authored Dec 6, 2024
1 parent 92cc740 commit 1729fca
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ class MockConnectionManager implements ConnectionManager, Startable {
return map
}

getMaxConnections (): number {
return 10_000
}

async openConnection (peerId: PeerId | Multiaddr | Multiaddr[]): Promise<Connection> {
if (isMultiaddr(peerId)) {
throw new UnsupportedOperationError('Dialing multiaddrs not supported')
Expand Down
6 changes: 6 additions & 0 deletions packages/interface-internal/src/connection-manager/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ export interface ConnectionManager {
*/
getConnectionsMap(): PeerMap<Connection[]>

/**
* Returns the configured maximum number of connections this connection
* manager will accept
*/
getMaxConnections(): number

/**
* Open a connection to a remote peer
*
Expand Down

0 comments on commit 1729fca

Please sign in to comment.