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

hyperswarm

Package Overview
Dependencies
Maintainers
0
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.7.15 to 4.8.0

34

index.js

@@ -59,3 +59,17 @@ const { EventEmitter } = require('events')

this.listening = null
this.stats = { updates: 0 }
this.stats = {
updates: 0,
connects: {
client: {
opened: 0,
closed: 0,
attempted: 0
},
server: {
// Note: there is no notion of 'attempts' for server connections
opened: 0,
closed: 0
}
}
}

@@ -173,2 +187,4 @@ this._discovery = new Map()

this.stats.connects.client.attempted++
this.connecting++

@@ -180,2 +196,4 @@ this._clientConnections++

opened = true
this.stats.connects.client.opened++
this._connectDone()

@@ -200,2 +218,4 @@ this.connections.add(conn)

if (!opened) this._connectDone()
this.stats.connects.client.closed++
this.connections.delete(conn)

@@ -281,5 +301,9 @@ this._allConnections.delete(conn)

if (existing) {
// If both connections are from the same peer,
// - pick the new one if the existing stream is already established (has sent and received bytes),
// because the other client must have lost that connection and be reconnecting
// - otherwise, pick the one thats expected to initiate in a tie break
const existingIsOutdated = existing.rawBytesRead > 0 && existing.rawBytesWritten > 0
const expectedInitiator = b4a.compare(conn.publicKey, conn.remotePublicKey) > 0
// if both connections are from the same peer, pick the one thats expected to initiate in a tie break
const keepNew = expectedInitiator === conn.isInitiator
const keepNew = existingIsOutdated || (expectedInitiator === conn.isInitiator)

@@ -299,2 +323,5 @@ if (keepNew === false) {

// When reaching here, the connection will always be 'opened' next tick
this.stats.connects.server.opened++
const peerInfo = this._upsertPeer(conn.remotePublicKey, null)

@@ -310,2 +337,3 @@

this._serverConnections--
this.stats.connects.server.closed++

@@ -312,0 +340,0 @@ this._maybeDeletePeer(peerInfo)

2

package.json
{
"name": "hyperswarm",
"version": "4.7.15",
"version": "4.8.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