-
Notifications
You must be signed in to change notification settings - Fork 446
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
[conn-manager] Detecting slow/stale connections #413
Comments
Hello @dryajov Thanks for exposing your options. I would go with option 2, as it is the one that does not have relevant My main concern with the first option is the generation of extra traffic in the network. |
Agreed, I like 2 as well. |
This might be better left to the underlying transport to handle (i.e. TCP read timeout, WebRTC and WebTransport also handle this with onConnection event listeners.) |
Replaces [err-code](https://github.com/IndigoUnited/js-err-code/blob/master/index.js) with [CodeError](libp2p/js-libp2p-interfaces#314) Related: [js-libp2p#1269](libp2p#1269) Changes - removes err-code from dependencies - adds @libp2p/[email protected] to dependencies - uses CodeError in place of err-code
## [7.0.1](libp2p/js-libp2p-kad-dht@v7.0.0...v7.0.1) (2023-03-10) ### Bug Fixes * correct `KBucketTree` types ([libp2p#426](libp2p/js-libp2p-kad-dht#426)) ([ea8e6d0](libp2p/js-libp2p-kad-dht@ea8e6d0)), closes [/github.com/tristanls/k-bucket/blob/3aa5b4f1dacb835752995a25409ab319d2070b9e/index.js#L413](https://github.com/libp2p//github.com/tristanls/k-bucket/blob/3aa5b4f1dacb835752995a25409ab319d2070b9e/index.js/issues/L413) * update p-queue types ([libp2p#428](libp2p/js-libp2p-kad-dht#428)) ([f5b85fc](libp2p/js-libp2p-kad-dht@f5b85fc)) ### Trivial Changes * replace err-code with CodeError ([libp2p#413](libp2p/js-libp2p-kad-dht#413)) ([e05d2a0](libp2p/js-libp2p-kad-dht@e05d2a0)), closes [js-libp2p#1269](libp2p#1269) * Update .github/workflows/semantic-pull-request.yml [skip ci] ([a70ab3f](libp2p/js-libp2p-kad-dht@a70ab3f)) * Update .github/workflows/semantic-pull-request.yml [skip ci] ([1652c6c](libp2p/js-libp2p-kad-dht@1652c6c)) * Update .github/workflows/semantic-pull-request.yml [skip ci] ([ea13c2a](libp2p/js-libp2p-kad-dht@ea13c2a))
Currently, there is no mechanism to detect if a connection has become stale (other side died) or slow/unresponsive. I've been thinking of ways to solve it, and a couple come to mind.
1) Ping/pong mechanism
Implement a ping/pong mechanism and if latency is too high or no response has been received within a time period, then disconnect/cleanup.
Pros:
Cons:
2) Detecting idle connections
Measure if any data has been sent/received within a time frame, if not then close/cleanup the connection.
Pros:
Cons:
3) Use both of the above options
Track a connection, and if we detect it as idle, then start a ping, if the ping fails the clean it up.
The text was updated successfully, but these errors were encountered: