Socket
Socket
Sign inDemoInstall

hyperswarm

Package Overview
Dependencies
Maintainers
4
Versions
88
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hyperswarm - npm Package Compare versions

Comparing version 4.3.7 to 4.4.0

27

index.js

@@ -47,2 +47,3 @@ const { EventEmitter } = require('events')

this.maxParallel = maxParallel
this.connecting = 0
this.connections = new Set()

@@ -65,3 +66,2 @@ this.peers = new Map()

this._drainingQueue = false
this._connecting = 0
this._clientConnections = 0

@@ -105,3 +105,3 @@ this._serverConnections = 0

_flushAllMaybe () {
if (this._connecting > 0 || (this._allConnections.size < this.maxPeers && this._clientConnections < this.maxClientConnections)) {
if (this.connecting > 0 || (this._allConnections.size < this.maxPeers && this._clientConnections < this.maxClientConnections)) {
return false

@@ -120,3 +120,3 @@ }

return !this.destroyed &&
this._connecting < this.maxParallel &&
this.connecting < this.maxParallel &&
this._allConnections.size < this.maxPeers &&

@@ -154,3 +154,3 @@ this._clientConnections < this.maxClientConnections

this._allConnections.add(conn)
this._connecting++
this.connecting++
this._clientConnections++

@@ -169,2 +169,4 @@ let opened = false

this._attemptClientConnections()
this.emit('update')
})

@@ -181,9 +183,14 @@ conn.on('error', noop)

this._flushMaybe(peerInfo)
this.emit('update')
})
this.emit('update')
}
_connectDone () {
this._connecting--
if (this._connecting < this.maxParallel) this._attemptClientConnections()
if (this._connecting === 0) this._flushAllMaybe()
this.connecting--
if (this.connecting < this.maxParallel) this._attemptClientConnections()
if (this.connecting === 0) this._flushAllMaybe()
}

@@ -202,3 +209,3 @@

this._drainingQueue = false
if (this._connecting === 0) this._flushAllMaybe()
if (this.connecting === 0) this._flushAllMaybe()
}

@@ -273,5 +280,9 @@

this._attemptClientConnections()
this.emit('update')
})
peerInfo.client = false
this.emit('connection', conn, peerInfo)
this.emit('update')
}

@@ -278,0 +289,0 @@

{
"name": "hyperswarm",
"version": "4.3.7",
"version": "4.4.0",
"description": "A distributed networking stack for connecting peers",

@@ -5,0 +5,0 @@ "files": [

@@ -51,2 +51,5 @@ # hyperswarm

#### `swarm.connecting`
Number that indicates connections in progress.
#### `swarm.connections`

@@ -70,2 +73,7 @@ A set of all active client/server connections.

#### `swarm.on('update', () => {})`
Emitted when internal values are changed, useful for user interfaces.
For example: emitted when `swarm.connecting` or `swarm.connections` changes.
#### `const discovery = swarm.join(topic, opts = {})`

@@ -72,0 +80,0 @@ Start discovering and connecting to peers sharing a common topic. As new peers are connected to, they will be emitted from the swarm as `connection` events.

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc