Skip to content
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

Reset peer's endpoint when NAT traversal fails to connect to any endpoint candidates #262

Merged
merged 2 commits into from
May 31, 2023

Conversation

bschwind
Copy link
Member

@bschwind bschwind commented May 28, 2023

Closes #260

We had the logic already to reset a peer's endpoint to the server-provided endpoint when no endpoint candidates were viable, but we were missing a call to it at the end of nat.rs.

Otherwise the client was always setting the endpoint to the last endpoint in the list of NAT candidates given from the server, which triggered a diff on every fetch.

I think this was just an oversight from the original commit here:

9e55d80 (PR)

@bschwind bschwind requested review from strohel and mcginty May 28, 2023 14:34
Copy link
Member

@strohel strohel left a comment

Choose a reason for hiding this comment

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

Oh yay, I've long wished to do a change along these lines!

One suggestion to slightly different approach to the implementation, though not sure what you'd think of it.

client/src/nat.rs Outdated Show resolved Hide resolved
client/src/nat.rs Outdated Show resolved Hide resolved
client/src/nat.rs Outdated Show resolved Hide resolved
Copy link
Member

@strohel strohel left a comment

Choose a reason for hiding this comment

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

Oh nice! Not counting the comment (which is nice and needed), this even resulted in net code (logic) removal.

Copy link
Collaborator

@mcginty mcginty left a comment

Choose a reason for hiding this comment

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

Logic looks cleaner, I like it!

@bschwind bschwind merged commit bd4aabe into main May 31, 2023
@bschwind bschwind deleted the reset-endpoint-on-no-connect branch May 31, 2023 02:48
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.

Peers are reported as "modified" when fetching repeatedly
3 participants