refactor(gossipsub): use send_message for all RpcOut#12
Merged
jxs merged 3 commits intoNov 22, 2024
Merged
Conversation
jxs
reviewed
Nov 20, 2024
jxs
left a comment
Owner
There was a problem hiding this comment.
Thanks for taking the time to test the solution Elena, and thanks for other parts of code that were also not elegant.
Looks good to me! Left just a couple comments
elenaf9
commented
Nov 21, 2024
jxs
approved these changes
Nov 21, 2024
jxs
left a comment
Owner
There was a problem hiding this comment.
Thanks Elena! Going to merge this and address your remaining comments on libp2p#5595
elenaf9
added a commit
to elenaf9/rust-libp2p
that referenced
this pull request
Nov 22, 2024
4 tasks
jxs
added a commit
that referenced
this pull request
Nov 22, 2024
fix(gossipsub): readd lines accidently removed with #12
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.
Description
Follow-up on libp2p#5595 (comment).
I've played around a bit with restoring the old
Behavior::send_messagefunction.It is now using a new
RpcSender::send_messagemethod, that handles sending of all Rpc messages, instead of having separate methodsRpcSender::{publish, subscribe, forward, ...}.The advantages of this design IMO are:
Behavior::send_messagehandles all errors in sending. Before, there was quite a bit of code duplication for a) handling that the target peer was not among the connected peers, and b) handling if a channel is full (logging the error, increasing the counter) c) handling that the channel will never be full for high priority control messages.RpcSender::send_messagethat decides which rpc message is sent on which channel,Drawbacks:
RpcSender::send_messagereturns anResultfor all rpc message, even though there are some high priority messages where sending can never fail.Behavior::send_messagehandles a returned error for these variants with anunreachable, but obviously it would be nicer if that logic would be directly inside theRpcSender.Notes & open questions
ControlMessagePoollogic, but based on an out of band discussion with @jxs, this logic is not needed/ wanted anymore.Change checklist
A changelog entry has been made in the appropriate crates