Improve error when connecting with an unsupported version - #1482
Merged
Conversation
djc
previously approved these changes
Jan 24, 2023
| if remote.port() == 0 || remote.ip().is_unspecified() { | ||
| return Err(ConnectError::InvalidRemoteAddress(remote)); | ||
| } | ||
| if !self.config.supported_versions.contains(&config.version) { |
Member
There was a problem hiding this comment.
Style nit: I think else if would make sense here?
Collaborator
Author
There was a problem hiding this comment.
The current pattern is consistent with the two existing checks. I also generally like how it makes them syntactically independent.
Member
There was a problem hiding this comment.
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.
Collaborator
Author
There was a problem hiding this comment.
(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
force-pushed
the
better-version-error
branch
from
January 24, 2023 21:52
bbb6fb4 to
6776354
Compare
Ralith
enabled auto-merge (rebase)
January 24, 2023 22:17
djc
approved these changes
Jan 25, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.