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.
Based over #80
Right now the
MuxedTransport
trait provides three methods:dial
,listen_on
anddial_and_listen
. The difference betweendial
anddial_and_listen
is that the latter allows you to handle the substreams that are opened by the node you dialed.Whenever you use a muxed transport, you are strongly encouraged to use
dial_and_listen
instead of justdial
.This PR simplifies this design by removing
dial_and_listen
entirely, and replacing it with anext_incoming
method that will consume the transport and return the next opened substream. Since the transport is generally clonable, you can easily turn that into a stream of incoming connections.