-
Notifications
You must be signed in to change notification settings - Fork 593
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
Normalize IPv6 used in Endpoint.equivalent #3428
base: main
Are you sure you want to change the base?
Conversation
@@ -1610,6 +1610,27 @@ IceInternal::getNumericAddress(const std::string& address) | |||
} | |||
} | |||
|
|||
string | |||
IceInternal::normalizeIPv6Address(string_view host) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would use a const string& for host since you give it to inet_pton that expects a null-terminated C-string.
@@ -117,7 +120,7 @@ public override bool equivalent(EndpointI endpoint) | |||
} | |||
IPEndpointI ipEndpointI = (IPEndpointI)endpoint; | |||
return ipEndpointI.type() == type() && | |||
ipEndpointI.host_.Equals(host_, StringComparison.Ordinal) && | |||
ipEndpointI._normalizedHost.Equals(_normalizedHost, StringComparison.Ordinal) && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would use operator== to compare these strings.
See https://learn.microsoft.com/en-us/dotnet/csharp/how-to/compare-strings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make the intent of your code clear by calling an overload that explicitly specifies the type of comparison to perform.
Isn't that what we do here? Afaik there is a linter rule for this.
C# and C++, Java was already done see #3154.
I don't think we need to update JavaScript,