hyperswarm
Advanced tools
Comparing version 3.0.3 to 3.0.4
@@ -32,9 +32,8 @@ const { EventEmitter } = require('events') | ||
} = opts | ||
this.keyPair = keyPair | ||
const networkOpts = {} | ||
if (opts.bootstrap) networkOpts.bootstrap = opts.bootstrap | ||
this.dht = opts.dht || new DHT(networkOpts) | ||
this.dht = opts.dht || new DHT({ | ||
bootstrap: opts.bootstrap, | ||
debug: opts.debug | ||
}) | ||
this.server = this.dht.createServer({ | ||
@@ -41,0 +40,0 @@ firewall: this._handleFirewall.bind(this) |
{ | ||
"name": "hyperswarm", | ||
"version": "3.0.3", | ||
"version": "3.0.4", | ||
"description": "A distributed networking stack for connecting peers", | ||
@@ -5,0 +5,0 @@ "dependencies": { |
@@ -346,2 +346,47 @@ const { timeout } = require('nonsynchronous') | ||
test('constructor options - debug options forwarded to DHT constructor', async (bootstrap, t) => { | ||
const swarm1 = new Hyperswarm({ | ||
bootstrap, | ||
backoffs: BACKOFFS, | ||
jitter: 0, | ||
debug: { | ||
handshake: { | ||
latency: [500, 500] | ||
} | ||
} | ||
}) | ||
const swarm2 = new Hyperswarm({ | ||
bootstrap, | ||
backoffs: BACKOFFS, | ||
jitter: 0, | ||
debug: { | ||
handshake: { | ||
latency: [500, 500] | ||
} | ||
} | ||
}) | ||
const connected = new Promise(resolve => { | ||
let connections = 0 | ||
const onconnect = () => { | ||
if (++connections === 2) resolve() | ||
} | ||
swarm1.once('connection', onconnect) | ||
swarm2.once('connection', onconnect) | ||
}) | ||
const topic = Buffer.alloc(32).fill('hello world') | ||
await swarm1.join(topic, { server: true }).flushed() | ||
const start = Date.now() | ||
swarm2.join(topic, { client: true }) | ||
await connected | ||
const duration = Date.now() - start | ||
t.true(duration > 500) | ||
await destroyAll(swarm1, swarm2) | ||
t.end() | ||
}) | ||
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
57007
20
1418