Skip to content

Commit

Permalink
knownNodes -> nodes (#185)
Browse files Browse the repository at this point in the history
* knownNodes -> nodes

* Remove opts.debug

* Remove `options.debug` tests
  • Loading branch information
AndreiRegiani authored Oct 9, 2024
1 parent d8eab52 commit 55727ee
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 53 deletions.
3 changes: 1 addition & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ module.exports = class Hyperswarm extends EventEmitter {

this.dht = opts.dht || new DHT({
bootstrap: opts.bootstrap,
debug: opts.debug,
knownNodes: opts.knownNodes
nodes: opts.nodes
})
this.server = this.dht.createServer({
firewall: this._handleFirewall.bind(this),
Expand Down
51 changes: 0 additions & 51 deletions test/swarm.js
Original file line number Diff line number Diff line change
Expand Up @@ -418,57 +418,6 @@ test('one server, one client - correct deduplication when a client connection is
swarm2.join(topic, { server: false, client: true })
})

test('constructor options - debug options forwarded to DHT constructor', async (t) => {
const { bootstrap } = await createTestnet(3, t.teardown)

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 = t.test('connection')
connected.plan(2)

swarm1.once('connection', (conn) => {
connected.pass('swarm1')
conn.on('error', noop)
})
swarm2.once('connection', (conn) => {
connected.pass('swarm2')
conn.on('error', noop)
})

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.ok(duration > 500)

await swarm1.destroy()
await swarm2.destroy()
})

test('flush when max connections reached', async (t) => {
const { bootstrap } = await createTestnet(3, t.teardown)

Expand Down

0 comments on commit 55727ee

Please sign in to comment.