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

Clear local options from computed published endpoints #3178

Merged
merged 5 commits into from
Nov 22, 2024

Conversation

bernardnormier
Copy link
Member

This PR clears local endpoint options (such as --interface) from published endpoints.

Fixes #3176.

@@ -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_;
Copy link
Member Author

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.

shared_ptr<EndpointI>
IceInternal::TcpEndpointI::toPublishedEndpoint(string publishedHost) const
{
if (publishedHost.empty() && !isAddressValid(_sourceAddr) && _connectionId.empty())
Copy link
Member

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.

Copy link
Member Author

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>(
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member

@externl externl left a 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!

@bernardnormier bernardnormier merged commit 8637f3f into zeroc-ice:main Nov 22, 2024
19 checks passed
@bernardnormier bernardnormier deleted the clean-published branch December 9, 2024 17:10
InsertCreativityHere pushed a commit to InsertCreativityHere/compiler-comparison that referenced this pull request Jan 1, 2025
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.

Clear local endpoint options from default PublishedEndpoints
3 participants