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

Elide SocketFlags in Socket API #57634

Merged
merged 5 commits into from
Sep 14, 2021
Merged

Elide SocketFlags in Socket API #57634

merged 5 commits into from
Sep 14, 2021

Conversation

i3arnon
Copy link
Contributor

@i3arnon i3arnon commented Aug 18, 2021

Fix #43934

@dotnet-issue-labeler
Copy link

Note regarding the new-api-needs-documentation label:

This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, to please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change.

@ghost ghost added the community-contribution Indicates that the PR has been added by a community member label Aug 18, 2021
@ghost
Copy link

ghost commented Aug 18, 2021

Tagging subscribers to this area: @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

Issue Details

Fix #43934

Author: i3arnon
Assignees: -
Labels:

area-System.Net.Sockets, new-api-needs-documentation

Milestone: -

@i3arnon
Copy link
Contributor Author

i3arnon commented Aug 18, 2021

I've left out ReceiveMessageFrom as the SocketFlags does return data from the operation:

Copy link
Member

@antonfirsov antonfirsov left a comment

Choose a reason for hiding this comment

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

Thank you for the contribution! The implementation looks good.

What's worrying me that the overloads that elide SocketFlags are missing test coverage (both old and new ones). I think we should fix this as part of the current PR.

I believe it would be an overkill to address this by duplicating our tests a couple of more times by adding more SocketHelperBase subclasses, unnecessarily penalizing our test execution time. My recommendation would be to change the existing SocketHelperTask and SocketHelperSpanSync to elide SocketFlags in their calls to Socket. We aren't really testing the effect of SocketFlags in those tests anyways. @geoffkizer do you agree?

I've left out ReceiveMessageFrom as the SocketFlags does return data from the operation:

@geoffkizer do you think it's a useful overload regardless? The approved proposal is also questioning them: #43934 (comment)

@i3arnon
Copy link
Contributor Author

i3arnon commented Aug 19, 2021

My recommendation would be to change the existing SocketHelperTask and SocketHelperSpanSync to elide SocketFlags in their calls to Socket

Done.

@geoffkizer do you think it's a useful overload regardless? The approved proposal is also questioning them: #43934 (comment)

I'll add that also in the sync overloads, there's an overload for ReceiveFrom that elides the flags, which are not passed by ref, but there isn't one for ReceiveMessageFrom which passes the flags by ref.

@geoffkizer
Copy link
Contributor

My recommendation would be to change the existing SocketHelperTask and SocketHelperSpanSync to elide SocketFlags in their calls to Socket. We aren't really testing the effect of SocketFlags in those tests anyways. @geoffkizer do you agree?

Just to be clear -- the idea here is that we cover these new overloads by making some of the existing test variations use them, but leave some using the old overloads so we continue to have coverage for those as well?

That seems reasonable to me.

Let's make sure to add comments that explain this, otherwise it will be far from obvious and we'll look at the code in the future and say "why are we using these overloads here but those overloads there??"

@geoffkizer
Copy link
Contributor

I'll add that also in the sync overloads, there's an overload for ReceiveFrom that elides the flags, which are not passed by ref, but there isn't one for ReceiveMessageFrom which passes the flags by ref.

This is a strong argument for not eliding the flags on ReceiveMessageFrom.

@karelz karelz added this to the 7.0.0 milestone Aug 20, 2021
Copy link
Member

@antonfirsov antonfirsov left a comment

Choose a reason for hiding this comment

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

Just one thing, and this is good to merge. I think we should leave out the sync ReceiveMessageFrom.

@antonfirsov
Copy link
Member

/azp run runtime-libraries-coreclr outerloop

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Member

@antonfirsov antonfirsov left a comment

Choose a reason for hiding this comment

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

LGTM. Shall be good to merge once outerloop CI completes.

@antonfirsov
Copy link
Member

Outerloop failures are unrelated (#32955 and a bunch of ProcessStartInfo tests on Windows 11).

@antonfirsov antonfirsov merged commit 975aa54 into dotnet:main Sep 14, 2021
@antonfirsov
Copy link
Member

@i3arnon thanks again for the work and your patience!

@i3arnon i3arnon deleted the socket-flags branch September 14, 2021 19:39
@ghost ghost locked as resolved and limited conversation to collaborators Nov 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Net.Sockets community-contribution Indicates that the PR has been added by a community member new-api-needs-documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consider adding Socket Send/ReceiveAsync overloads that elide SocketFlags argument
4 participants