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

Refactor EndpointInfo in C# #3185

Merged
merged 2 commits into from
Nov 26, 2024

Conversation

bernardnormier
Copy link
Member

This PR simplifies EndpointInfo in C#, in particular, make all the fields readonly.

/// <returns>True if the endpoint is secure.</returns>
public abstract bool secure();
/// <remarks>The type of an underlying endpoint is always the same as the type its enclosing endpoint.</remarks>
public virtual short type() => underlying?.type() ?? -1;
Copy link
Member

Choose a reason for hiding this comment

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

Should we instead assert underlying is not null?

Copy link
Member Author

Choose a reason for hiding this comment

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

Even with a Debug.Assert, we would still need to return something. So I think -1 is fine here.

info.timeout = info.underlying.timeout;
return info;
}
public override EndpointInfo getInfo() => new WSEndpointInfo(_delegate.getInfo(), _resource);
Copy link
Member

Choose a reason for hiding this comment

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

It's not clear to me how the secure, type, datagram, timeout, compress fields of this returned WSEndpointInfo are set.

They should be set to the underlying endpoint info values.

Copy link
Member

Choose a reason for hiding this comment

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

I think it works similar to how it did before, the difference is that type(), secure(), .. are called once when constructed.

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 the base class, Ice.EndpointInfo.

type(), datagram() and secure() delegate to underlying, while the timeout and compress fields are set in the constructor from underlying.

@bernardnormier bernardnormier merged commit 750f781 into zeroc-ice:main Nov 26, 2024
18 of 19 checks passed
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.

3 participants