- Notifications
You must be signed in to change notification settings - Fork5.2k
Added Span overloads for Socket.SendFile#47230
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
ghost commentedJan 20, 2021
Note regarding the 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 commentedJan 20, 2021
Tagging subscribers to this area: @dotnet/ncl Issue DetailsFixes#43846 This PR is split-out of#45132 -- see#45132 (comment) for context.
|
Uh oh!
There was an error while loading.Please reload this page.
src/libraries/System.Net.Sockets/src/System/Net/Sockets/Socket.cs OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
src/libraries/System.Net.Sockets/src/System/Net/Sockets/SocketPal.Windows.csShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
geoffkizer commentedJan 20, 2021
Tests? |
gfoidl commentedJan 20, 2021
Tests for the array-based implementation are there, and as these forward to the span-based implementation that's covered. |
geoffkizer commentedJan 20, 2021
We should add explicit span tests too. Yeah it's duplicative, but that's fine; better to be duplicative than to miss something. |
antonfirsov commentedJan 21, 2021 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
To support all the refactoring described in#45132 (comment) and#43845, we should refactor I strongly suggest to do it in this PR. |
gfoidl commentedJan 21, 2021
@antonfirsov the refactoring of the tests makes sense, but can this be done in a different PR? I'd like to focus this PR on adding the span-overloads. And maybe the major reason for my pushback is, that I'm not familiar with
I see#46862 and other code that uses the SocketTestHelperBase<T> but this doesn't make it sound for that change.Maybe I'm missing a trivial piece of the puzzle now, or we have to do this separately. |
antonfirsov commentedJan 21, 2021 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@gfoidl
What I wanted was to avoid bloating the current |
gfoidl commentedJan 21, 2021
Thanks for the explaination!
to see how it's done (and use that knowledge then for the SendFileAsync tests). |
geoffkizer commentedJan 21, 2021
I'm fine to defer the |
geoffkizer commentedJan 21, 2021
ok -- are we ready to merge then?@antonfirsov any remaining concerns? |
gfoidl commentedJan 21, 2021
I have no more changes planned for this PR. So ready to merge from my side. |
antonfirsov commentedJan 22, 2021
/azp run runtime-libraries-coreclr outerloop |
| Azure Pipelines successfully started running 1 pipeline(s). |
antonfirsov left a comment
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.
LGTM. I have some comments regarding tests, but let's ignore them, since it doesn't make sense to do alterations to test code we are about to completely refactor anyways.
I want to merge as soon as the outerloop run finishes.
| } | ||
| } | ||
| [ConditionalTheory] |
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.
[PlatformSpecific] is enough to make this conditional,[ConditionalTheory] is used when you need to evaluatebool members at runtime.
| if(useAsync) | ||
| { | ||
| awaitAssert.ThrowsAsync<SocketException>(()=>Task.Factory.FromAsync<string>(client.BeginSendFile,client.EndSendFile,filename,null)); |
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.
Wouldn't it make sense to also checkSocketException.SocketErrorCode?
| /// <exception cref="ObjectDisposedException">The <see cref="Socket"/> object has been closed.</exception> | ||
| /// <exception cref="NotSupportedException">The <see cref="Socket"/> object is not connected to a remote host.</exception> | ||
| /// <exception cref="InvalidOperationException">The <see cref="Socket"/> object is not in blocking mode and cannot accept this synchronous call.</exception> | ||
| /// <exception cref="FileNotFoundException">The file <paramref name="fileName"/> was not found.</exception> |
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 like we don't have test for theFileNotFoundException case.
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.
Indeed, that's missing.
As the tests will be refactored, should we file an issue for this and where these points get collected? Or won't we forget about this anyway?
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.
If one of us manages to PR the test refactor within a week, I wouldn't bother with an issue, otherwise it would be wise to start tracking it.
My main fear is that more extensive testing will discover a bunch of corner cases and platform inconsistencies (or even actual bugs) we'll have to deal with. This is what made things hard with my other PR.
antonfirsov commentedJan 25, 2021
OuterLoop test failures are unrelated: |
antonfirsov commentedJan 26, 2021
@gfoidl FYI I have started refactoring the SendFile tests, if everything goes well, expect a PR within a day. |
gfoidl commentedJan 26, 2021
Thanks for the update -- happy to have a look at the PR (then start the async versions of sendfile). |
Refactor tests in SendFile.cs to utilize SocketTestHelper<T>As a result cover some cases which were uncovered before (for example Dispose VS async).Add more checks and tests as discussed in#47230.
Fixes#43846
This PR is split-out of#45132 -- see#45132 (comment) for context.