-
Notifications
You must be signed in to change notification settings - Fork 77
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
Send IDONTWANT prior to publish #386
Send IDONTWANT prior to publish #386
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.
LGTM, I'd just leave the peer exclusion
@@ -610,15 +611,14 @@ open class GossipRouter( | |||
enqueueIwant(peer, messageIds) | |||
} | |||
|
|||
private fun iDontWant(msg: PubsubMessage, receivedFrom: PeerHandler) { | |||
private fun iDontWant(msg: PubsubMessage) { |
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.
TBH I would leave the excluded peer. We are saving one IDONTWANT message for free.
private fun iDontWant(msg: PubsubMessage) { | |
private fun iDontWant(msg: PubsubMessage?) { |
if (!this.protocol.supportsIDontWant()) return | ||
if (msg.protobufMessage.data.size() < params.iDontWantMinMessageSizeThreshold) return | ||
// we need to send IDONTWANT messages to mesh peers immediately in order for them to have an effect | ||
msg.topics | ||
.mapNotNull { mesh[it] } | ||
.flatten() | ||
.distinct() | ||
.minus(receivedFrom) |
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.
.minus(setOfNotNull(receivedFrom))
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.
Oh, I was looking for a nice way to add it back. This one seems good. Implemented.
Send IDONTWANT on each publish. Maybe we need to add some filtering to make it more selective, but not sure?
I removed filtering out excluding the
receivedFrom
peer when we are sending IDONTWANT on inbound messages. Think it simplifies the flow and could help in some cases, wherereceivedFrom
may send the same message twice.fixes #383