-
Notifications
You must be signed in to change notification settings - Fork 0
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
refactor(gossipsub): use send_message
for all RpcOut
#12
refactor(gossipsub): use send_message
for all RpcOut
#12
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Elena! Going to merge this and address your remaining comments on libp2p#5595
b626118
into
jxs:impl-gossipsub-backpressure-2
fix(gossipsub): readd lines accidently removed with #12
Description
Follow-up on libp2p#5595 (comment).
I've played around a bit with restoring the old
Behavior::send_message
function.It is now using a new
RpcSender::send_message
method, that handles sending of all Rpc messages, instead of having separate methodsRpcSender::{publish, subscribe, forward, ...}
.The advantages of this design IMO are:
Behavior::send_message
handles 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_message
that decides which rpc message is sent on which channel,Drawbacks:
RpcSender::send_message
returns anResult
for all rpc message, even though there are some high priority messages where sending can never fail.Behavior::send_message
handles 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
ControlMessagePool
logic, 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