-
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
Clear local options from computed published endpoints #3178
Clear local options from computed published endpoints #3178
Conversation
@@ -152,8 +150,7 @@ public override bool equivalent(EndpointI endpoint) | |||
IPEndpointI ipEndpointI = (IPEndpointI)endpoint; | |||
return ipEndpointI.type() == type() && | |||
ipEndpointI.host_.Equals(host_, StringComparison.Ordinal) && | |||
ipEndpointI.port_ == port_ && | |||
Network.addressEquals(ipEndpointI.sourceAddr_, sourceAddr_); | |||
ipEndpointI.port_ == port_; |
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.
Removed sourceAddr from this equivalent comparison in C# and Java; in C++, we didn't check sourceAddr.
cpp/src/Ice/TcpEndpointI.cpp
Outdated
shared_ptr<EndpointI> | ||
IceInternal::TcpEndpointI::toPublishedEndpoint(string publishedHost) const | ||
{ | ||
if (publishedHost.empty() && !isAddressValid(_sourceAddr) && _connectionId.empty()) |
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 read this as:
If the published host is empty and there is no local options. The published endpoint is the actual endpoint. Otherwise replace publishedHost and remove local options.
Maybe add a comment to clarify.
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.
See latest version.
An empty publishedHost means "keep existing host as is".
shared_ptr<EndpointI> | ||
IceInternal::UdpEndpointI::toPublishedEndpoint(string publishedHost) const | ||
{ | ||
return make_shared<UdpEndpointI>( |
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.
Why not reuse current endpoint like in tcp, is it never possible?
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.
It's possible, but requires more code/complexity, and there is no benefit since we don't compute these published endpoints often.
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.
Looks good to me!
This PR clears local endpoint options (such as --interface) from published endpoints.
Fixes #3176.