Skip to content

Commit 1729fca

Browse files
authored
feat: add getMaxConnections method to connection manager (#2877)
Adds a method to expose the max connections config setting.
1 parent 92cc740 commit 1729fca

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

packages/interface-compliance-tests/src/mocks/connection-manager.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ class MockConnectionManager implements ConnectionManager, Startable {
9797
return map
9898
}
9999

100+
getMaxConnections (): number {
101+
return 10_000
102+
}
103+
100104
async openConnection (peerId: PeerId | Multiaddr | Multiaddr[]): Promise<Connection> {
101105
if (isMultiaddr(peerId)) {
102106
throw new UnsupportedOperationError('Dialing multiaddrs not supported')

packages/interface-internal/src/connection-manager/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ export interface ConnectionManager {
4646
*/
4747
getConnectionsMap(): PeerMap<Connection[]>
4848

49+
/**
50+
* Returns the configured maximum number of connections this connection
51+
* manager will accept
52+
*/
53+
getMaxConnections(): number
54+
4955
/**
5056
* Open a connection to a remote peer
5157
*

0 commit comments

Comments
 (0)