Skip to content

Send IDONTWANT prior to publish#386

Merged
StefanBratanov merged 2 commits intolibp2p:developfrom
StefanBratanov:send_idont_want
Oct 18, 2024
Merged

Send IDONTWANT prior to publish#386
StefanBratanov merged 2 commits intolibp2p:developfrom
StefanBratanov:send_idont_want

Conversation

@StefanBratanov
Copy link
Copy Markdown
Collaborator

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, where receivedFrom may send the same message twice.

fixes #383

Copy link
Copy Markdown
Collaborator

@Nashatyrev Nashatyrev left a 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

}

private fun iDontWant(msg: PubsubMessage, receivedFrom: PeerHandler) {
private fun iDontWant(msg: PubsubMessage) {
Copy link
Copy Markdown
Collaborator

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.

Suggested change
private fun iDontWant(msg: PubsubMessage) {
private fun iDontWant(msg: PubsubMessage?) {

.mapNotNull { mesh[it] }
.flatten()
.distinct()
.minus(receivedFrom)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

            .minus(setOfNotNull(receivedFrom))

Copy link
Copy Markdown
Collaborator Author

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.

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.

Gossip: send IDONTWANT selectively prior to publish

2 participants