This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Add ProtocolBehaviour#2922
Merged
Merged
Conversation
twittner
approved these changes
Jun 21, 2019
twittner
left a comment
Contributor
There was a problem hiding this comment.
LGTM (besides some weird formatting).
| } | ||
|
|
||
| impl<B: BlockT, S: NetworkSpecialization<B>, H: ExHashT> ProtocolBehaviour<B, S, H> { | ||
| /// Builds a new `ProtocolsBehaviour`. |
Contributor
There was a problem hiding this comment.
Suggested change
| /// Builds a new `ProtocolsBehaviour`. | |
| /// Builds a new `ProtocolBehaviour`. |
| } | ||
|
|
||
| /// Returns the list of all the peers we have an open channel to. | ||
| pub fn open_peers<'a>(&'a self) -> impl Iterator<Item = &'a PeerId> + 'a { |
Contributor
There was a problem hiding this comment.
Suggested change
| pub fn open_peers<'a>(&'a self) -> impl Iterator<Item = &'a PeerId> + 'a { | |
| pub fn open_peers(&self) -> impl Iterator<Item = &PeerId> { |
| Ok(Async::NotReady) => {} | ||
| Err(err) => void::unreachable(err), | ||
| } | ||
| } |
Contributor
There was a problem hiding this comment.
These block delimiters are not necessary.
bkchr
approved these changes
Jun 24, 2019
| ); | ||
| } | ||
|
|
||
| // TODO: needed? |
Member
There was a problem hiding this comment.
Every TODO should be an issue in github.
Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>
Contributor
Author
|
Fixed the nitpicks! |
MTDK1
pushed a commit
to bdevux/substrate
that referenced
this pull request
Jul 10, 2019
* Add ProtocolBehaviour * Fix tests * Line widths * Address concerns * Apply suggestions from code review Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com> * Remove TODO
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
The next step in the refactoring is to implement the libp2p
NetworkBehaviourtrait onProtocol. This was done by adding aProtocolBehaviourstruct.In other words:
Before:
CustomProto <-> Service <-> Protocol.After:
Service <-> (CustomProto <-> Protocol), and the thing in parentheses isProtocolBehaviour.This made it possible to move
start_servicein the constructor ofNetworkWorker, which I did as well.This unlocks the next step, which is to split
Protocolin multipleNetworkBehaviours.Because #2500 was "rejected", I've had to use some hacks for granting access to the gossiping and specialization. It is unclear how I will clean that up, but I'll try to find a solution.