Skip to content

Send IDONTWANT before first publish #612

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

MarcoPolo
Copy link
Contributor

@MarcoPolo MarcoPolo commented May 6, 2025

See #610

We previously send IDONTWANT only when forwarding. This has us send IDONTWANT on our initial publish as well. Helps in the case that one or more peers may also publish the same thing at around the same time (see #610 for a longer explanation) and prevents "boomerang" duplicates where a peer sends you back the message you sent before you get a chance to send it to them.

This also serves as a hint to a peer that you are about to send them a certain message.

@MarcoPolo MarcoPolo marked this pull request as ready for review May 8, 2025 17:21
@MarcoPolo MarcoPolo force-pushed the marco/IDONTWANT-on-publish branch from f8b4150 to cf90c94 Compare May 8, 2025 21:53
@MarcoPolo MarcoPolo requested a review from raulk May 9, 2025 04:27
@@ -349,6 +349,7 @@ func (t *Topic) validate(ctx context.Context, data []byte, opts ...PubOpt) (*Mes
}

msg := &Message{m, "", t.p.host.ID(), pub.validatorData, pub.local}
t.p.rt.PreValidation(t.p.host.ID(), []*Message{msg})
Copy link
Member

@raulk raulk May 9, 2025

Choose a reason for hiding this comment

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

While we're working on this area, how about we rename PreValidation() to something more accurate/obvious, e.g. DispatchIDONTWANT() or even something more generic like Preprocess() or Intercept()? The spirit of the method just isn't to validate (returns nothing), and it's confusing when juxtaposed with ValidateLocal() ("what validation happens in each?").

Copy link
Collaborator

Choose a reason for hiding this comment

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

names, names, names 🤣

But yes, preprocessing is what it does.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No strong opinion. Preprocess seems fine.

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.

3 participants