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 2.1.0 to 2.1.1

12

lib/queue.js

@@ -75,3 +75,8 @@ 'use strict'

const queue = info.requeue()
if (queue === -1) return false
if (queue === -1) {
// Either we exhausted reconnect attempts, the peer was banned or
// reconnect is disabled. In any case - we have to remove the peer.
this._remove[info.banned ? 1 : 0].push(info)
return false
}
this._requeue[queue].push(info)

@@ -93,3 +98,3 @@ return true

// 'topic' event instead of making dup connections, per topic
const id = toID(peer) + (peer.topic ? '@' + peer.topic.toString('hex') : '')
const id = toID(peer)

@@ -137,5 +142,6 @@ let info = this._infos.get(id)

function toID (peer) {
return peer.host + ':' + peer.port
return peer.host + ':' + peer.port +
(peer.topic ? '@' + peer.topic.toString('hex') : '')
}
module.exports.PeerQueue = PeerQueue
{
"name": "hyperswarm",
"version": "2.1.0",
"version": "2.1.1",
"description": "A distributed networking stack for connecting peers",

@@ -5,0 +5,0 @@ "main": "swarm.js",

@@ -20,3 +20,3 @@ 'use strict'

const q = queue({
requeue: [ 100, 200, 300 ]
requeue: [ 100, 200, 300 ],
})

@@ -38,5 +38,35 @@

is(q.requeue(info), false)
q.destroy()
})
test('requeue forget unresponsive', async ({ is }) => {
const q = queue({
requeue: [ 100, 200, 300 ],
forget: { unresponsive: 100 },
})
q.add({ port: 8080, host: '127.0.0.1' })
const info = q.shift()
is(q.requeue(info), true)
await once(q, 'readable')
is(q.shift(), info)
is(q.requeue(info), true)
await once(q, 'readable')
is(q.shift(), info)
is(q.requeue(info), true)
await once(q, 'readable')
is(q.shift(), info)
is(q.requeue(info), false)
// Check that the info gets purged from the queue
is(q._infos.size, 1)
await timeout(200)
is(q._infos.size, 0)
q.destroy()
})
test('peers with same details are deduped', async ({ is, same }) => {

@@ -43,0 +73,0 @@ const q = queue()

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