Merge release/2.1
This commit is contained in:
commit
ddf3e948ad
|
|
@ -1,4 +1,4 @@
|
|||
<Project>
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
|
||||
</PropertyGroup>
|
||||
|
|
@ -28,20 +28,20 @@
|
|||
<MicrosoftExtensionsPlatformAbstractionsPackageVersion>1.1.0</MicrosoftExtensionsPlatformAbstractionsPackageVersion>
|
||||
<MicrosoftExtensionsSecurityHelperSourcesPackageVersion>2.1.0-preview1-28117</MicrosoftExtensionsSecurityHelperSourcesPackageVersion>
|
||||
<MicrosoftNETCoreApp20PackageVersion>2.0.0</MicrosoftNETCoreApp20PackageVersion>
|
||||
<MicrosoftNETCoreApp21PackageVersion>2.1.0-preview1-26115-03</MicrosoftNETCoreApp21PackageVersion>
|
||||
<MicrosoftNETCoreApp21PackageVersion>2.1.0-preview2-26124-07</MicrosoftNETCoreApp21PackageVersion>
|
||||
<MicrosoftNetHttpHeadersPackageVersion>2.1.0-preview1-28117</MicrosoftNetHttpHeadersPackageVersion>
|
||||
<MicrosoftNETTestSdkPackageVersion>15.3.0</MicrosoftNETTestSdkPackageVersion>
|
||||
<MicrosoftWebAdministrationPackageVersion>7.0.0</MicrosoftWebAdministrationPackageVersion>
|
||||
<SystemBuffersPackageVersion>4.5.0-preview1-26112-01</SystemBuffersPackageVersion>
|
||||
<SystemIOPipelinesPackageVersion>0.1.0-e180104-2</SystemIOPipelinesPackageVersion>
|
||||
<SystemBuffersPackageVersion>4.5.0-preview2-26125-06</SystemBuffersPackageVersion>
|
||||
<SystemIOPipelinesPackageVersion>0.1.0-preview2-180130-1</SystemIOPipelinesPackageVersion>
|
||||
<SystemManagementAutomationPackageVersion>6.1.7601.17515</SystemManagementAutomationPackageVersion>
|
||||
<SystemMemoryPackageVersion>4.5.0-preview1-26112-01</SystemMemoryPackageVersion>
|
||||
<SystemNumericsVectorsPackageVersion>4.5.0-preview1-26112-01</SystemNumericsVectorsPackageVersion>
|
||||
<SystemRuntimeCompilerServicesUnsafePackageVersion>4.5.0-preview1-26112-01</SystemRuntimeCompilerServicesUnsafePackageVersion>
|
||||
<SystemSecurityPrincipalWindowsPackageVersion>4.5.0-preview1-26112-01</SystemSecurityPrincipalWindowsPackageVersion>
|
||||
<SystemTextEncodingsWebUtf8PackageVersion>0.1.0-e180104-2</SystemTextEncodingsWebUtf8PackageVersion>
|
||||
<SystemMemoryPackageVersion>4.5.0-preview2-26125-06</SystemMemoryPackageVersion>
|
||||
<SystemNumericsVectorsPackageVersion>4.5.0-preview2-26125-06</SystemNumericsVectorsPackageVersion>
|
||||
<SystemRuntimeCompilerServicesUnsafePackageVersion>4.5.0-preview2-26125-06</SystemRuntimeCompilerServicesUnsafePackageVersion>
|
||||
<SystemSecurityPrincipalWindowsPackageVersion>4.5.0-preview2-26125-06</SystemSecurityPrincipalWindowsPackageVersion>
|
||||
<SystemTextEncodingsWebUtf8PackageVersion>0.1.0-preview2-180130-1</SystemTextEncodingsWebUtf8PackageVersion>
|
||||
<XunitPackageVersion>2.3.1</XunitPackageVersion>
|
||||
<XunitRunnerVisualStudioPackageVersion>2.3.1</XunitRunnerVisualStudioPackageVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(DotNetPackageVersionPropsPath)" Condition=" '$(DotNetPackageVersionPropsPath)' != '' " />
|
||||
</Project>
|
||||
</Project>
|
||||
|
|
@ -141,8 +141,8 @@ namespace Microsoft.AspNetCore.Server.IISIntegration
|
|||
RequestBody = new IISHttpRequestBody(this);
|
||||
ResponseBody = new IISHttpResponseBody(this);
|
||||
|
||||
Input = new Pipe(new PipeOptions(_memoryPool, readerScheduler: Scheduler.TaskRun));
|
||||
var pipe = new Pipe(new PipeOptions(_memoryPool, readerScheduler: Scheduler.TaskRun));
|
||||
Input = new Pipe(new PipeOptions(_memoryPool, readerScheduler: PipeScheduler.ThreadPool));
|
||||
var pipe = new Pipe(new PipeOptions(_memoryPool, readerScheduler: PipeScheduler.ThreadPool));
|
||||
Output = new OutputProducer(pipe);
|
||||
}
|
||||
|
||||
|
|
@ -165,7 +165,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration
|
|||
internal WindowsPrincipal WindowsUser { get; set; }
|
||||
public Stream RequestBody { get; set; }
|
||||
public Stream ResponseBody { get; set; }
|
||||
public IPipe Input { get; set; }
|
||||
public Pipe Input { get; set; }
|
||||
public OutputProducer Output { get; set; }
|
||||
|
||||
public IHeaderDictionary RequestHeaders { get; set; }
|
||||
|
|
@ -253,7 +253,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration
|
|||
}
|
||||
finally
|
||||
{
|
||||
Input.Reader.Advance(readableBuffer.End, readableBuffer.End);
|
||||
Input.Reader.AdvanceTo(readableBuffer.End, readableBuffer.End);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -438,22 +438,22 @@ namespace Microsoft.AspNetCore.Server.IISIntegration
|
|||
while (true)
|
||||
{
|
||||
// These buffers are pinned
|
||||
var wb = Input.Writer.Alloc(MinAllocBufferSize);
|
||||
_inputHandle = wb.Buffer.Retain(true);
|
||||
var wb = Input.Writer.GetMemory(MinAllocBufferSize);
|
||||
_inputHandle = wb.Retain(true);
|
||||
|
||||
try
|
||||
{
|
||||
int read = 0;
|
||||
if (_wasUpgraded)
|
||||
{
|
||||
read = await ReadWebSocketsAsync(wb.Buffer.Length);
|
||||
read = await ReadWebSocketsAsync(wb.Length);
|
||||
}
|
||||
else
|
||||
{
|
||||
_currentOperation = _currentOperation.ContinueWith(async (t) =>
|
||||
{
|
||||
_currentOperationType = CurrentOperationType.Read;
|
||||
read = await ReadAsync(wb.Buffer.Length);
|
||||
read = await ReadAsync(wb.Length);
|
||||
}).Unwrap();
|
||||
await _currentOperation;
|
||||
}
|
||||
|
|
@ -463,15 +463,15 @@ namespace Microsoft.AspNetCore.Server.IISIntegration
|
|||
break;
|
||||
}
|
||||
|
||||
wb.Advance(read);
|
||||
Input.Writer.Advance(read);
|
||||
}
|
||||
finally
|
||||
{
|
||||
wb.Commit();
|
||||
Input.Writer.Commit();
|
||||
_inputHandle.Dispose();
|
||||
}
|
||||
|
||||
var result = await wb.FlushAsync();
|
||||
var result = await Input.Writer.FlushAsync();
|
||||
|
||||
if (result.IsCompleted || result.IsCancelled)
|
||||
{
|
||||
|
|
@ -555,19 +555,19 @@ namespace Microsoft.AspNetCore.Server.IISIntegration
|
|||
}
|
||||
finally
|
||||
{
|
||||
Output.Reader.Advance(consumed);
|
||||
Output.Reader.AdvanceTo(consumed);
|
||||
}
|
||||
}
|
||||
Output.Reader.Complete();
|
||||
}
|
||||
|
||||
private unsafe IISAwaitable WriteAsync(ReadOnlyBuffer buffer)
|
||||
private unsafe IISAwaitable WriteAsync(ReadOnlyBuffer<byte> buffer)
|
||||
{
|
||||
var fCompletionExpected = false;
|
||||
var hr = 0;
|
||||
var nChunks = 0;
|
||||
|
||||
if (buffer.IsSingleSpan)
|
||||
if (buffer.IsSingleSegment)
|
||||
{
|
||||
nChunks = 1;
|
||||
}
|
||||
|
|
@ -579,7 +579,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration
|
|||
}
|
||||
}
|
||||
|
||||
if (buffer.IsSingleSpan)
|
||||
if (buffer.IsSingleSegment)
|
||||
{
|
||||
var pDataChunks = stackalloc HttpApiTypes.HTTP_DATA_CHUNK[1];
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System;
|
||||
using System.Buffers;
|
||||
using System.IO.Pipelines;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
|
@ -17,7 +18,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration
|
|||
|
||||
private bool _completed = false;
|
||||
|
||||
private readonly IPipe _pipe;
|
||||
private readonly Pipe _pipe;
|
||||
|
||||
// https://github.com/dotnet/corefxlab/issues/1334
|
||||
// Pipelines don't support multiple awaiters on flush
|
||||
|
|
@ -26,13 +27,13 @@ namespace Microsoft.AspNetCore.Server.IISIntegration
|
|||
private readonly object _flushLock = new object();
|
||||
private Action _flushCompleted;
|
||||
|
||||
public OutputProducer(IPipe pipe)
|
||||
public OutputProducer(Pipe pipe)
|
||||
{
|
||||
_pipe = pipe;
|
||||
_flushCompleted = OnFlushCompleted;
|
||||
}
|
||||
|
||||
public IPipeReader Reader => _pipe.Reader;
|
||||
public PipeReader Reader => _pipe.Reader;
|
||||
|
||||
public Task FlushAsync(CancellationToken cancellationToken = default(CancellationToken))
|
||||
{
|
||||
|
|
@ -73,8 +74,6 @@ namespace Microsoft.AspNetCore.Server.IISIntegration
|
|||
ArraySegment<byte> buffer,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
var writableBuffer = default(WritableBuffer);
|
||||
|
||||
lock (_contextLock)
|
||||
{
|
||||
if (_completed)
|
||||
|
|
@ -82,26 +81,16 @@ namespace Microsoft.AspNetCore.Server.IISIntegration
|
|||
throw new ObjectDisposedException("Response is already completed");
|
||||
}
|
||||
|
||||
writableBuffer = _pipe.Writer.Alloc(1);
|
||||
// TODO obsolete
|
||||
#pragma warning disable CS0618 // Type or member is obsolete
|
||||
var writer = new WritableBufferWriter(writableBuffer);
|
||||
#pragma warning restore CS0618 // Type or member is obsolete
|
||||
if (buffer.Count > 0)
|
||||
{
|
||||
writer.Write(buffer.Array, buffer.Offset, buffer.Count);
|
||||
}
|
||||
|
||||
writableBuffer.Commit();
|
||||
_pipe.Writer.Write(new ReadOnlySpan<byte>(buffer.Array, buffer.Offset, buffer.Count));
|
||||
}
|
||||
|
||||
return FlushAsync(writableBuffer, cancellationToken);
|
||||
return FlushAsync(_pipe.Writer, cancellationToken);
|
||||
}
|
||||
|
||||
private Task FlushAsync(WritableBuffer writableBuffer,
|
||||
private Task FlushAsync(PipeWriter pipeWriter,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
var awaitable = writableBuffer.FlushAsync(cancellationToken);
|
||||
var awaitable = pipeWriter.FlushAsync(cancellationToken);
|
||||
if (awaitable.IsCompleted)
|
||||
{
|
||||
// The flush task can't fail today
|
||||
|
|
|
|||
Loading…
Reference in New Issue