diff --git a/client.js b/client.js index f9d53d2..f448f07 100644 --- a/client.js +++ b/client.js @@ -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) }) diff --git a/package.json b/package.json index ddf869c..7762228 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hypertele", - "version": "1.1.2", + "version": "1.1.3", "description": "TCP proxy over Hyperswarm!", "main": "index.js", "dependencies": { @@ -9,7 +9,7 @@ "hyper-cmd-lib-keys": "^0.1.0", "hyper-cmd-lib-net": "^0.1.0", "hyper-cmd-lib-utils": "^0.1.0", - "hyperdht": "^6.11.0", + "hyperdht": "^6.14.0", "minimist": "^1.2.5" }, "bin": { diff --git a/pub.js b/pub.js index 13b3b9b..a2d708e 100644 --- a/pub.js +++ b/pub.js @@ -21,6 +21,7 @@ if (!+argv.l) { } const conf = {} +conf.keepAlive = 5000 if (argv.seed) { conf.seed = argv.seed @@ -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 } diff --git a/server.js b/server.js index 49067bb..4f6d306 100644 --- a/server.js +++ b/server.js @@ -27,6 +27,7 @@ if (argv.u && argv.l) { } const conf = {} +conf.keepAlive = 5000 if (argv.seed) { conf.seed = argv.seed @@ -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 = {}