fix dead multiaddresses blocking working multiaddresses#1151
Open
pokefan77 wants to merge 4 commits into
Open
Conversation
Add is_onion to wait() and DialRequest, and make release_ready serve the first clearnet waiter before any onion at the same priority, so a reachable clearnet address is not starved by an onion dial that hangs on a dead service. Update the existing test call-sites to the new signature and add tests for clearnet-first and onion-only serving.
…t-permit Add an outer DialLimiterTransport wrapper that acquires the Tor dial permit before polling the inner dial, then bounds it with tokio::time::timeout, so the time spent queued for a slot is excluded from the timeout. Remove the dial limiter from TorTransport (it now just connects) and drop the now-dead DialLimiter error variant.
…port Extract authenticate_and_multiplex_no_timeout and keep authenticate_and_multiplex as that plus the timeout so the ASB is unchanged. Rewire the CLI transport to wrap the no-timeout upgrade with DialLimiterTransport when Tor is enabled (timeout measured after the permit) and a plain timeout when Tor is disabled. Add a CHANGELOG entry.
Author
|
Ran into some compile errors while testing. Will update and confirm once manually tested end-to-end. |
libp2p-core 0.41's Transport trait has no imeout method, so calling .timeout() on a Boxed transport resolved to tokio_stream::StreamExt::timeout and failed to compile. Wrap the boxed transport with TransportTimeout::new(..) instead, in both the CLI transport (non-Tor branch) and authenticate_and_multiplex.
Author
|
compiles and LGTM, connecting fine and quick. ready for review. |
78d5219 to
7149353
Compare
Author
|
ignore force push, mixup with 1050. tested fine locally, discovery is fine, discovery is quicker overall and bugfix as described. good to go. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
currently: low priority peers get a single global slot. a dead onion (e.g. expired wormhole, other onion connectivity issues) holds that slot for 15 sec. the dial to other multiaddresses never happens.
this also partly addresses the issue of dead wormholes that we store in db that wont work. currently we cant dial those peers for above reason.
with the fix we will give EACH multiaddress its own 15sec timeout and prefer clearnet dial because this should fail fast if unavailable and then go to onion multiaddresses. clearnet addresses are still called over TOR not directly. libp2p will cancel further dials to other multiaddresses on success.
changes are localized to libp2p-tor and the CLI transport wiring. the Tor dial limiter moves from inside
TorTransportto a thin outer transport wrapper. no user-visible behaviour change (the ASB and the shared upgrade path are untouched). internally the dial permit is now held through the bounded handshake as well as the connect.i finally debugged this very annoying discovery issue after lots of testing, please take a look ASAP