Skip to content
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

Change the MuxedTransport trait #81

Merged
merged 3 commits into from
Jan 3, 2018

Conversation

tomaka
Copy link
Member

@tomaka tomaka commented Dec 20, 2017

Based over #80

Right now the MuxedTransport trait provides three methods: dial, listen_on and dial_and_listen. The difference between dial and dial_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 just dial.

This PR simplifies this design by removing dial_and_listen entirely, and replacing it with a next_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.

@tomaka tomaka force-pushed the muxed-transport-change branch from 302bda3 to 1801cd0 Compare December 30, 2017 13:12
@tomaka tomaka mentioned this pull request Jan 2, 2018
@tomaka tomaka force-pushed the muxed-transport-change branch from 1801cd0 to 47a3a24 Compare January 3, 2018 09:30
@tomaka tomaka mentioned this pull request Jan 3, 2018
Copy link
Contributor

@folsen folsen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have nothing to complain about, the API seems much cleaner and more intuitive.

@folsen folsen merged commit cba24ea into libp2p:master Jan 3, 2018
@tomaka tomaka deleted the muxed-transport-change branch January 3, 2018 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants