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

Always set keetAlive #15

Merged
merged 3 commits into from
Apr 3, 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
5 changes: 2 additions & 3 deletions client.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,13 @@ const stats = {}

const dht = new HyperDHT({
bootstrap,
keyPair
keyPair,
connectionKeepAlive: conf.keepAlive
})

const proxy = net.createServer({ allowHalfOpen: true }, c => {
return connPiper(c, () => {
const stream = dht.connect(Buffer.from(peer, 'hex'), { reusableSocket: true })
stream.setKeepAlive(conf.keepAlive)

return stream
}, { compress: conf.compress }, stats)
})
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"@hyper-cmd/lib-utils": "https://github.com/holepunchto/hyper-cmd-lib-utils#v0.0.2",
"b4a": "^1.6.4",
"graceful-goodbye": "^1.3.0",
"hyperdht": "^6.11.0",
"hyperdht": "^6.14.0",
"minimist": "^1.2.5"
},
"bin": {
Expand Down
3 changes: 2 additions & 1 deletion pub.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ if (!+argv.l) {
}

const conf = {}
conf.keepAlive = 5000

if (argv.seed) {
conf.seed = argv.seed
Expand Down Expand Up @@ -51,7 +52,7 @@ const debug = argv.debug

const seed = Buffer.from(conf.seed, 'hex')

const dht = new HyperDHT()
const dht = new HyperDHT({ connectionKeepAlive: conf.keepAlive })
const keyPair = HyperDHT.keyPair(seed)

const stats = { cid: 0 }
Expand Down
7 changes: 6 additions & 1 deletion server.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ if (argv.u && argv.l) {
}

const conf = {}
conf.keepAlive = 5000

if (argv.seed) {
conf.seed = argv.seed
Expand Down Expand Up @@ -69,7 +70,11 @@ const debug = argv.debug

const seed = Buffer.from(conf.seed, 'hex')

const dht = new HyperDHT({ bootstrap })
const dht = new HyperDHT({
bootstrap,
connectionKeepAlive: conf.keepAlive
})

const keyPair = HyperDHT.keyPair(seed)

const stats = {}
Expand Down
Loading