hyperswarm
Advanced tools
Comparing version 4.1.0 to 4.1.1
@@ -5,2 +5,3 @@ const { EventEmitter } = require('events') | ||
const b4a = require('b4a') | ||
const safetyCatch = require('safety-catch') | ||
@@ -329,3 +330,7 @@ const PeerInfo = require('./lib/peer-info') | ||
const topicString = b4a.toString(topic, 'hex') | ||
if (this._discovery.has(topicString)) return this._discovery.get(topicString) | ||
if (this._discovery.has(topicString)) { | ||
const discovery = this._discovery.get(topicString) | ||
discovery.refresh(opts).catch(safetyCatch) | ||
return discovery | ||
} | ||
const discovery = new PeerDiscovery(this, topic, { | ||
@@ -332,0 +337,0 @@ ...opts, |
{ | ||
"name": "hyperswarm", | ||
"version": "4.1.0", | ||
"version": "4.1.1", | ||
"description": "A distributed networking stack for connecting peers", | ||
@@ -9,2 +9,3 @@ "dependencies": { | ||
"events": "^3.3.0", | ||
"safety-catch": "^1.0.2", | ||
"shuffled-priority-queue": "^2.1.0" | ||
@@ -11,0 +12,0 @@ }, |
@@ -478,2 +478,26 @@ const test = require('brittle') | ||
test('rejoining with different client/server opts refreshes', async (t) => { | ||
const { bootstrap } = await createTestnet(3, t.teardown) | ||
const swarm1 = new Hyperswarm({ bootstrap }) | ||
const swarm2 = new Hyperswarm({ bootstrap }) | ||
const topic = Buffer.alloc(32).fill('hello world') | ||
swarm1.join(topic, { client: true, server: false }) | ||
await swarm1.join(topic, { client: true, server: true }).flushed() | ||
await swarm2 | ||
.on('connection', (conn) => conn.on('error', noop)) | ||
.join(topic, { client: true }) | ||
.flushed() | ||
await swarm2.flush() | ||
t.is(swarm2.connections.size, 1) | ||
await swarm1.destroy() | ||
await swarm2.destroy() | ||
}) | ||
function noop () {} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
58804
1446
5
+ Addedsafety-catch@^1.0.2