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 Socket.SendFile tests and extend coverage #47479

Merged
merged 13 commits into from
Jan 27, 2021

Conversation

antonfirsov
Copy link
Member

This is needed to unblock progress on #42591.

@geoffkizer @gfoidl PTAL

@ghost
Copy link

ghost commented Jan 26, 2021

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

Issue Details

This is needed to unblock progress on #42591.

@geoffkizer @gfoidl PTAL

Author: antonfirsov
Assignees: -
Labels:

area-System.Net.Sockets

Milestone: -

@@ -33,6 +33,8 @@ public abstract class SocketHelperBase
public abstract Task<int> SendAsync(Socket s, ArraySegment<byte> buffer);
public abstract Task<int> SendAsync(Socket s, IList<ArraySegment<byte>> bufferList);
public abstract Task<int> SendToAsync(Socket s, ArraySegment<byte> buffer, EndPoint endpoint);
public abstract Task SendFileAsync(Socket s, string fileName);
public abstract Task SendFileAsync(Socket s, string fileName, ArraySegment<byte> preBuffer, ArraySegment<byte> postBuffer, TransmitFileOptions flags);
Copy link
Member

Choose a reason for hiding this comment

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

Should these be ReadOnlyMemories instead of the ArraySegment?
The approved API for SendFileAsync is ROM-based, as opposed to e.g. SendAsync which has an overload for ArraySegment.

Copy link
Member Author

@antonfirsov antonfirsov Jan 26, 2021

Choose a reason for hiding this comment

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

These are wrappers (not the actual socket API-s). We are using ArraySegment<byte> so we can also feed the data to sync old array-based overloads from the shared test code.

Copy link
Member Author

@antonfirsov antonfirsov Jan 26, 2021

Choose a reason for hiding this comment

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

It is tricky with SocketTestHelperMemoryNativeTask: in that case we copy the data to an actual pointer-based ReadOnlyMemory<byte> from the ArraySegment in the helper implementation.

@antonfirsov

This comment has been minimized.

@azure-pipelines

This comment has been minimized.

Copy link
Member

@gfoidl gfoidl left a comment

Choose a reason for hiding this comment

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

This looks really nice now.

Copy link
Member

@wfurt wfurt left a comment

Choose a reason for hiding this comment

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

LGTM.

Copy link
Contributor

@geoffkizer geoffkizer left a comment

Choose a reason for hiding this comment

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

same nit as other PR :)

Otherwise looks great, Thanks!

@antonfirsov

This comment has been minimized.

@azure-pipelines

This comment has been minimized.

@antonfirsov

This comment has been minimized.

@azure-pipelines

This comment has been minimized.

# Conflicts:
#	src/libraries/System.Net.Sockets/tests/FunctionalTests/SocketTestHelper.cs
@antonfirsov
Copy link
Member Author

/azp run runtime-libraries-coreclr outerloop

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@antonfirsov
Copy link
Member Author

OuterLoop test failuires are unrelated: #1479, #43207, #46619

@antonfirsov antonfirsov merged commit 0ff4f4a into dotnet:master Jan 27, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Feb 27, 2021
@karelz karelz added this to the 6.0.0 milestone May 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants