Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
billiegoose committed Jul 5, 2024
1 parent e56c035 commit 5a66f09
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions test/manual/measure-reconnect.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const { DEV_BLIND_RELAY_KEYS } = require('@holepunchto/keet-default-config')
const HypercoreId = require('hypercore-id-encoding')
const DEV_RELAY_KEYS = DEV_BLIND_RELAY_KEYS.map(HypercoreId.decode)
console.log('DEV_RELAY_KEYS', DEV_RELAY_KEYS.map(b => b.toString('hex').slice(0, 8) + '...'))
const relayThrough = (force) => true ? DEV_RELAY_KEYS : null
const relayThrough = (force) => force ? DEV_RELAY_KEYS : null

const Hyperswarm = require('../..')

Expand All @@ -42,17 +42,12 @@ swarm.on('connection', async (conn) => {
console.log(conn.rawStream.remoteHost)
console.log(conn.rawStream.remotePort)
console.log(conn.relay)
conn.on('relay', (...args) => console.log('relay-', ...args))
conn.on('error', (...args) => console.log('error-', ...args))
conn.on('close', (...args) => console.log('close-', ...args))
conn.on('relay', (...args) => console.log('relay:', ...args))
conn.on('error', (...args) => console.log('error:', ...args))
conn.on('close', (...args) => console.log('close:', ...args))
conn.on('data', (data) => console.log(data.toString('utf8')))
conn.setKeepAlive(5000)
conn.write('hello')
// swarm.dht.ping({ host: conn.rawStream.remoteHost, port: conn.rawStream.remotePort }, { ttl: 100, timeout: 10000 })
// .then(console.log)
// .catch(console.log)
// const conn2 = swarm.dht.connect('cd5f6268eb5f124bff18684cdcc6db4a54463f99e1bd3074d15f545f0146ea92', { ttl: 100, timeout: 10000 })
// conn2.on('open', () => console.log('hey'))
if (!connected) {
connected = true
console.timeEnd('INITIAL CONNECTION TIME')
Expand All @@ -63,8 +58,6 @@ swarm.on('connection', async (conn) => {

console.time('INITIAL CONNECTION TIME')
swarm.join(topic)
// swarm.dht.connect('cd5f6268eb5f124bff18684cdcc6db4a54463f99e1bd3074d15f545f0146ea92', { relayThrough: DEV_RELAY_KEYS, ttl: 100 })
// swarm.dht.ping()

process.on('SIGINT', () => {
swarm.leave(topic).then(() => process.exit())
Expand Down

0 comments on commit 5a66f09

Please sign in to comment.