Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hyperswarm

Package Overview
Dependencies
Maintainers
4
Versions
90
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.5.1 to 4.6.0

29

index.js

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

this.destroyed = false
this.suspended = false
this.maxPeers = maxPeers

@@ -83,2 +84,3 @@ this.maxClientConnections = maxClientConnections

_requeue (batch) {
if (this.suspended) return
for (const peerInfo of batch) {

@@ -121,2 +123,3 @@ peerInfo.waiting = false

return !this.destroyed &&
!this.suspended &&
this.connecting < this.maxParallel &&

@@ -128,2 +131,3 @@ this._allConnections.size < this.maxPeers &&

_shouldRequeue (peerInfo) {
if (this.suspended) return false
if (peerInfo.explicit) return true

@@ -215,2 +219,3 @@ for (const topic of peerInfo.topics) {

_handleFirewall (remotePublicKey, payload) {
if (this.suspended) return true
if (b4a.equals(remotePublicKey, this.keyPair.publicKey)) return true

@@ -452,2 +457,26 @@

suspend () {
if (this.suspended) return
this.suspended = true
for (const discovery of this._discovery.values()) {
discovery.suspend()
}
for (const connection of this._allConnections) {
connection.destroy()
}
}
resume () {
if (!this.suspended) return
this.suspended = false
for (const discovery of this._discovery.values()) {
discovery.resume()
}
this._attemptClientConnections()
}
topics () {

@@ -454,0 +483,0 @@ return this._discovery.values()

19

lib/peer-discovery.js

@@ -15,2 +15,3 @@ const safetyCatch = require('safety-catch')

this.destroying = null
this.suspended = false

@@ -121,3 +122,3 @@ this._sessions = []

if (this.destroyed) return
if (this.suspended) return

@@ -200,2 +201,18 @@ if (server === this.isServer && client === this.isClient) {

}
suspend () {
if (this.suspended) return
this.suspended = true
if (this._timer) {
clearTimeout(this._timer)
this._timer = null
}
}
resume () {
if (!this.suspended) return
this.suspended = false
this.refresh()
}
}

@@ -202,0 +219,0 @@

2

package.json
{
"name": "hyperswarm",
"version": "4.5.1",
"version": "4.6.0",
"description": "A distributed networking stack for connecting peers",

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

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