Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

knownNodes -> nodes #185

Merged
merged 3 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading