Imported Upstream version 6.6.0.144

Former-commit-id: 335a70f3c58a7479968dcaae1d3412c2da9f9a3a
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2019-10-25 09:01:16 +00:00
parent 85bcceff8c
commit 790c4870fc
245 changed files with 629 additions and 257 deletions

View File

@ -12,7 +12,7 @@ using System.Threading.Tasks;
namespace System.Net.Sockets
{
// Provides the underlying stream of data for network access.
public class NetworkStream : Stream
public partial class NetworkStream : Stream
{
// Used by the class to hold the underlying socket the stream uses.
private readonly Socket _streamSocket;

View File

@ -52,7 +52,7 @@ namespace System.Net.Sockets
internal Task<Socket> AcceptAsync(Socket acceptSocket)
{
// Get any cached SocketAsyncEventArg we may have.
TaskSocketAsyncEventArgs<Socket> saea = Interlocked.Exchange(ref LazyInitializer.EnsureInitialized(ref _cachedTaskEventArgs).TaskAccept, s_rentedSocketSentinel);
TaskSocketAsyncEventArgs<Socket> saea = Interlocked.Exchange(ref LazyInitializer.EnsureInitialized(ref _cachedTaskEventArgs, () => { return new CachedEventArgs(); }).TaskAccept, s_rentedSocketSentinel);
if (saea == s_rentedSocketSentinel)
{
// An instance was once created (or is currently being created elsewhere), but some other
@ -194,7 +194,7 @@ namespace System.Net.Sockets
return new ValueTask<int>(Task.FromCanceled<int>(cancellationToken));
}
AwaitableSocketAsyncEventArgs saea = LazyInitializer.EnsureInitialized(ref LazyInitializer.EnsureInitialized(ref _cachedTaskEventArgs).ValueTaskReceive);
AwaitableSocketAsyncEventArgs saea = LazyInitializer.EnsureInitialized(ref LazyInitializer.EnsureInitialized(ref _cachedTaskEventArgs, () => { return new CachedEventArgs(); } ).ValueTaskReceive, () => { return new AwaitableSocketAsyncEventArgs(); });
if (saea.Reserve())
{
Debug.Assert(saea.BufferList == null);
@ -343,7 +343,7 @@ namespace System.Net.Sockets
return new ValueTask<int>(Task.FromCanceled<int>(cancellationToken));
}
AwaitableSocketAsyncEventArgs saea = LazyInitializer.EnsureInitialized(ref LazyInitializer.EnsureInitialized(ref _cachedTaskEventArgs).ValueTaskSend);
AwaitableSocketAsyncEventArgs saea = LazyInitializer.EnsureInitialized(ref LazyInitializer.EnsureInitialized(ref _cachedTaskEventArgs, () => { return new CachedEventArgs(); } ).ValueTaskSend, () => { return new AwaitableSocketAsyncEventArgs(); });
if (saea.Reserve())
{
Debug.Assert(saea.BufferList == null);
@ -367,7 +367,7 @@ namespace System.Net.Sockets
return new ValueTask(Task.FromCanceled(cancellationToken));
}
AwaitableSocketAsyncEventArgs saea = LazyInitializer.EnsureInitialized(ref LazyInitializer.EnsureInitialized(ref _cachedTaskEventArgs).ValueTaskSend);
AwaitableSocketAsyncEventArgs saea = LazyInitializer.EnsureInitialized(ref LazyInitializer.EnsureInitialized(ref _cachedTaskEventArgs, () => { return new CachedEventArgs(); } ).ValueTaskSend, () => { return new AwaitableSocketAsyncEventArgs(); });
if (saea.Reserve())
{
Debug.Assert(saea.BufferList == null);
@ -644,7 +644,7 @@ namespace System.Net.Sockets
private Int32TaskSocketAsyncEventArgs RentSocketAsyncEventArgs(bool isReceive)
{
// Get any cached SocketAsyncEventArg we may have.
CachedEventArgs cea = LazyInitializer.EnsureInitialized(ref _cachedTaskEventArgs);
CachedEventArgs cea = LazyInitializer.EnsureInitialized(ref _cachedTaskEventArgs, () => { return new CachedEventArgs(); });
Int32TaskSocketAsyncEventArgs saea = isReceive ?
Interlocked.Exchange(ref cea.TaskReceive, s_rentedInt32Sentinel) :
Interlocked.Exchange(ref cea.TaskSend, s_rentedInt32Sentinel);

View File

@ -215,6 +215,7 @@ namespace System.Net.Sockets.Tests
[Theory]
[MemberData(nameof(ReadAsync_ContinuesOnCurrentContextIfDesired_MemberData))]
[SkipOnTargetFramework(TargetFrameworkMonikers.Mono, "Mono does not yet support `continueOnCapturedContext`.")]
public async Task ReadAsync_ContinuesOnCurrentSynchronizationContextIfDesired(
bool flowExecutionContext, bool? continueOnCapturedContext)
{