Skip to content

Conversation

@sigaloid
Copy link

…l messages

Description

Simply add a nonce field to the chat message to ensure duplicate messages are still delivered

Breaking Changes

N/A

Notes & open questions

Discussion in #iroh-gossip in Discord

Change checklist

  • Self-review.
  • Documentation updates following the style guide, if relevant.
  • Tests if relevant.
  • All breaking changes documented.

@n0bot n0bot bot added this to iroh Apr 20, 2025
@github-project-automation github-project-automation bot moved this to 🏗 In progress in iroh Apr 20, 2025
Copy link
Member

@matheus23 matheus23 left a comment

Choose a reason for hiding this comment

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

Thank you so much for the PR.
I'd appreciate if you could address the PR comments. After those are addressed, I'm fairly confident it's ready to merge.

/// unique, so two identical chat messages are still delivered.
Message {
text: String,
nonce: u32,
Copy link
Member

Choose a reason for hiding this comment

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

This is good! Can you make it a [u8; 16] though, just to make it borderline practically impossible for colliding nonces for the price of just a couple more bytes to send?

Suggested change
nonce: u32,
nonce: [u8; 16],

AboutMe { name: String },
Message { text: String },
AboutMe {
name: String,
Copy link
Member

Choose a reason for hiding this comment

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

This message probably also needs a nonce, since when a new peer joins, you'd want to send yet another AboutMe message with your current username, but that'd currently fail sending.

Suggested change
name: String,
name: String,
nonce: [u8; 16],

@matheus23
Copy link
Member

Fixes #61

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🏗 In progress

Development

Successfully merging this pull request may close these issues.

2 participants