-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
RoutedHost should search for addrs when none of the addrs we tried worked #351
Comments
I would like to have a crack at this task. I think it makes sense to also add tests that cover this case, there is no test file in the go-libp2p/p2p/host/routed folder. Should I put one there or is there somewhere else that the routed host is tested? |
This test case covers issue libp2p#351, which covers the routed host searching for new addresses if the current addresses for a peer do not work when connecting. The test uses a mock testrouter which implements the routing interface. This makes it easy to manipulate which addresses are available through the router and also makes the test self contained, meaning it isn't dependent on an external router.
If there were addresses available for a given peer, and they did not work, an err would be returned. This doesn't make sense as there should be an attempt to find new addresses through the router before determining that a connection cannot be made. Now the router is searched if a connection with the current addresses cannot be made. If the router had already been searched(This happens if no addresses were present in the peerinfo) then we do not search repeat the search as it doesn't to search the router twice within such a short timespan.
That's the correct place to test this (for now). Note: The real fix will probably require some refactoring. I'm steadily coming to the conclusion that we should be passing a pluggable router down into the Network (swarm). Really, we should probably be wrapping the peerstore with a router. However, that's not a simple fix... |
With the new dial pipeline being worked on here libp2p/go-libp2p-swarm#88, a |
This was fixed by #1835. |
Currently, if we have at least one address, we try that and never search the DHT. We should search the DHT. Ideally, we'd search in parallel after some timeout but that's tricky. The simple solution is to:
The text was updated successfully, but these errors were encountered: