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

Improve error when connecting with an unsupported version #1482

Merged
merged 1 commit into from
Jan 25, 2023

Conversation

Ralith
Copy link
Collaborator

@Ralith Ralith commented Jan 24, 2023

If the cryptographic layer supports a version not in the local endpoint's supported versions list, a connection was initiated but all packets returned by a compatible peer were dropped. This is a relatively easy configuration error to make.

Fixes #1481.

djc
djc previously approved these changes Jan 24, 2023
@@ -369,6 +369,9 @@ impl Endpoint {
if remote.port() == 0 || remote.ip().is_unspecified() {
return Err(ConnectError::InvalidRemoteAddress(remote));
}
if !self.config.supported_versions.contains(&config.version) {
Copy link
Member

Choose a reason for hiding this comment

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

Style nit: I think else if would make sense here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The current pattern is consistent with the two existing checks. I also generally like how it makes them syntactically independent.

Copy link
Member

Choose a reason for hiding this comment

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

Fair enough. I prefer the increased density over syntactic independence, I think. Also in my mind using else if would group these more as a set of preconditions, whereas the syntactic independence means I have to do more work parsing in my head because I consider each of them independently.

Anyway, either is fine.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

(needs reapproval though)

If the cryptographic layer supports a version not in the local
endpoint's supported versions list, a connection could have been
initiated with that version for which all packets returned by a
compatible peer would hav ebeendropped. This is a relatively easy
configuration error to make.
@Ralith Ralith merged commit d00a71c into main Jan 25, 2023
@Ralith Ralith deleted the better-version-error branch January 25, 2023 06:06
@djc djc mentioned this pull request May 8, 2023
3 tasks
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.

The custom version of the api is weird
2 participants