libp2p 2.8.9 → 2.8.10-7eed3b40d

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -206,7 +206,7 @@ export class DefaultConnectionManager implements ConnectionManager, Startable {
206
206
  private readonly maxIncomingPendingConnections: number
207
207
  private incomingPendingConnections: number
208
208
  private outboundPendingConnections: number
209
- private readonly maxConnections: number
209
+ private maxConnections: number
210
210
 
211
211
  public readonly dialQueue: DialQueue
212
212
  public readonly reconnectQueue: ReconnectQueue
@@ -261,7 +261,6 @@ export class DefaultConnectionManager implements ConnectionManager, Startable {
261
261
  events: components.events,
262
262
  logger: components.logger
263
263
  }, {
264
- maxConnections: this.maxConnections,
265
264
  allow: init.allow?.map(a => multiaddr(a))
266
265
  })
267
266
 
@@ -424,6 +423,24 @@ export class DefaultConnectionManager implements ConnectionManager, Startable {
424
423
  return this.maxConnections
425
424
  }
426
425
 
426
+ setMaxConnections (maxConnections: number): void {
427
+ if (this.maxConnections < 1) {
428
+ throw new InvalidParametersError('Connection Manager maxConnections must be greater than 0')
429
+ }
430
+
431
+ let needsPrune = false
432
+
433
+ if (maxConnections < this.maxConnections) {
434
+ needsPrune = true
435
+ }
436
+
437
+ this.maxConnections = maxConnections
438
+
439
+ if (needsPrune) {
440
+ this.connectionPruner.maybePruneConnections()
441
+ }
442
+ }
443
+
427
444
  onConnect (evt: CustomEvent<Connection>): void {
428
445
  void this._onConnect(evt).catch(err => {
429
446
  this.log.error(err)
package/src/version.ts CHANGED
@@ -1,2 +1,2 @@
1
- export const version = '2.8.9'
1
+ export const version = '2.8.10-7eed3b40d'
2
2
  export const name = 'js-libp2p'
@@ -1,21 +0,0 @@
1
- {
2
- "AddressFilter": "https://libp2p.github.io/js-libp2p/interfaces/libp2p.index.AddressFilter.html",
3
- "AddressManagerInit": "https://libp2p.github.io/js-libp2p/interfaces/libp2p.index.AddressManagerInit.html",
4
- "ConnectionManagerInit": "https://libp2p.github.io/js-libp2p/interfaces/libp2p.index.ConnectionManagerInit.html",
5
- "ConnectionMonitorInit": "https://libp2p.github.io/js-libp2p/interfaces/libp2p.index.ConnectionMonitorInit.html",
6
- "Libp2pInit": "https://libp2p.github.io/js-libp2p/interfaces/libp2p.index.Libp2pInit.html",
7
- ".:Libp2pInit": "https://libp2p.github.io/js-libp2p/interfaces/libp2p.index.Libp2pInit.html",
8
- "TransportManagerInit": "https://libp2p.github.io/js-libp2p/interfaces/libp2p.index.TransportManagerInit.html",
9
- "Libp2pOptions": "https://libp2p.github.io/js-libp2p/types/libp2p.index.Libp2pOptions.html",
10
- ".:Libp2pOptions": "https://libp2p.github.io/js-libp2p/types/libp2p.index.Libp2pOptions.html",
11
- "ServiceFactoryMap": "https://libp2p.github.io/js-libp2p/types/libp2p.index.ServiceFactoryMap.html",
12
- ".:ServiceFactoryMap": "https://libp2p.github.io/js-libp2p/types/libp2p.index.ServiceFactoryMap.html",
13
- "createLibp2p": "https://libp2p.github.io/js-libp2p/functions/libp2p.index.createLibp2p.html",
14
- ".:createLibp2p": "https://libp2p.github.io/js-libp2p/functions/libp2p.index.createLibp2p.html",
15
- "userAgent": "https://libp2p.github.io/js-libp2p/functions/libp2p.user-agent.userAgent.html",
16
- "./user-agent:userAgent": "https://libp2p.github.io/js-libp2p/functions/libp2p.user-agent.userAgent.html",
17
- "name": "https://libp2p.github.io/js-libp2p/variables/libp2p.version.name.html",
18
- "./version:name": "https://libp2p.github.io/js-libp2p/variables/libp2p.version.name.html",
19
- "version": "https://libp2p.github.io/js-libp2p/variables/libp2p.version.version.html",
20
- "./version:version": "https://libp2p.github.io/js-libp2p/variables/libp2p.version.version.html"
21
- }