Closed LuKks closed 1 year ago
I forgot, I think the firewall behaviour or the documentation is reversed, one or the other. Returning false allows the connection.
Can you share the full stack trace? That’d be super helpful :)
Unsure if we actually use the caching layer atm here, but connect supports passing in the nodes you think are best as “nodes” which is basically caching if you pass in the nodes that connected you just before
In DHT, findAndConnect
doesn't use opts
and I also can't figure out where opts.nodes
is actually passed in but I'll continue reading.
About the full stack trace Server (my machine):
/home/lucas/.config/yarn/global/node_modules/@hyperswarm/secret-stream/index.js:344
cb(null)
^
TypeError: cb is not a function
at NoiseSecretStream._write (/home/lucas/.config/yarn/global/node_modules/@hyperswarm/secret-stream/index.js:344:7)
at writeOrBuffer (internal/streams/writable.js:358:12)
at NoiseSecretStream.Writable.write (internal/streams/writable.js:303:10)
at NoiseSecretStream.emit (events.js:400:28)
at ReadableState.drain (/home/lucas/.config/yarn/global/node_modules/streamx/index.js:312:64)
at ReadableState.update (/home/lucas/.config/yarn/global/node_modules/streamx/index.js:319:10)
at ReadableState.updateReadNT (/home/lucas/.config/yarn/global/node_modules/streamx/index.js:477:8)
at processTicksAndRejections (internal/process/task_queues.js:77:11)
Client (virtual machine):
peer Error: UTP_ETIMEDOUT
at createUTPError (/home/lks/.config/yarn/global/node_modules/utp-native/lib/connection.js:238:15)
at Connection._onerror (/home/lks/.config/yarn/global/node_modules/utp-native/lib/connection.js:175:16) {
code: 'UTP_ETIMEDOUT',
errno: 2
}
/home/lks/.config/yarn/global/node_modules/@hyperswarm/secret-stream/index.js:365
cb(null)
^
TypeError: cb is not a function
at NoiseSecretStream._destroy (/home/lks/.config/yarn/global/node_modules/@hyperswarm/secret-stream/index.js:365:5)
at NoiseSecretStream.destroy (internal/streams/destroy.js:39:8)
at NoiseSecretStream.emit (events.js:412:35)
at WritableState.afterDestroy (/home/lks/.config/yarn/global/node_modules/streamx/index.js:442:19)
at NoiseSecretStream._destroy (/home/lks/.config/yarn/global/node_modules/@hyperswarm/secret-stream/index.js:365:5)
at WritableState.updateNonPrimary (/home/lks/.config/yarn/global/node_modules/streamx/index.js:189:16)
at WritableState.update (/home/lks/.config/yarn/global/node_modules/streamx/index.js:174:70)
at WritableState.updateWriteNT (/home/lks/.config/yarn/global/node_modules/streamx/index.js:482:8)
at processTicksAndRejections (internal/process/task_queues.js:77:11)
It can happen on one side only.
Oh, I have to create a new DHT instance? With the swarm connection as the bootstrap node so later just connect to the public key? Will try that, thanks!
Only one dht node is needed. Thanks for the stack I’ll look into it. Re the options, just let us look into it unless it’s pressing for you. In general we have an approach of “make it work 100%” before tuning the params etc.
on the firewall docs could you send a PR?
Fixed by this https://github.com/hyperswarm/dht/pull/89 (opts.reusableSocket)
How can I properly connect to a another peer without doing lookup each time? Let's say already did one lookup and it found a peer, later I would like to continue making multiple direct connections to that same ip:port without lookup every time. Any hints? I already read a lot of code like the previous version of hyperswarm and dht, also the new versions, noise-peer and noise-network but it still not clear.
Not related, I got one time:
I would try to reproduce it later, I think is doing conn.destroy() without callback? Not sure.
I really like this new version.