Reac to pipes in corefx (#618)

This commit is contained in:
Pavel Krymets 2018-02-28 12:42:09 -08:00 committed by GitHub
parent fcbe74fbf1
commit 2dac2e34fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 21 additions and 20 deletions

View File

@ -16,6 +16,8 @@
<SignAssembly>true</SignAssembly>
<PublicSign Condition="'$(OS)' != 'Windows_NT'">true</PublicSign>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<!-- https://github.com/aspnet/IISIntegration/issues/617 -->
<EnableApiCheck>false</EnableApiCheck>
</PropertyGroup>
</Project>

View File

@ -17,6 +17,7 @@
<MicrosoftAspNetCoreTestHostPackageVersion>2.1.0-preview2-30187</MicrosoftAspNetCoreTestHostPackageVersion>
<MicrosoftAspNetCoreTestingPackageVersion>2.1.0-preview2-30187</MicrosoftAspNetCoreTestingPackageVersion>
<MicrosoftAspNetCoreWebUtilitiesPackageVersion>2.1.0-preview2-30187</MicrosoftAspNetCoreWebUtilitiesPackageVersion>
<MicrosoftExtensionsBuffersSourcesPackageVersion>2.1.0-preview2-t000</MicrosoftExtensionsBuffersSourcesPackageVersion>
<MicrosoftExtensionsConfigurationEnvironmentVariablesPackageVersion>2.1.0-preview2-30187</MicrosoftExtensionsConfigurationEnvironmentVariablesPackageVersion>
<MicrosoftExtensionsConfigurationJsonPackageVersion>2.1.0-preview2-30187</MicrosoftExtensionsConfigurationJsonPackageVersion>
<MicrosoftExtensionsLoggingAbstractionsPackageVersion>2.1.0-preview2-30187</MicrosoftExtensionsLoggingAbstractionsPackageVersion>
@ -28,18 +29,17 @@
<MicrosoftExtensionsPlatformAbstractionsPackageVersion>1.1.0</MicrosoftExtensionsPlatformAbstractionsPackageVersion>
<MicrosoftExtensionsSecurityHelperSourcesPackageVersion>2.1.0-preview2-30187</MicrosoftExtensionsSecurityHelperSourcesPackageVersion>
<MicrosoftNETCoreApp20PackageVersion>2.0.0</MicrosoftNETCoreApp20PackageVersion>
<MicrosoftNETCoreApp21PackageVersion>2.1.0-preview2-26130-04</MicrosoftNETCoreApp21PackageVersion>
<MicrosoftNETCoreApp21PackageVersion>2.1.0-preview2-26225-03</MicrosoftNETCoreApp21PackageVersion>
<MicrosoftNetHttpHeadersPackageVersion>2.1.0-preview2-30187</MicrosoftNetHttpHeadersPackageVersion>
<MicrosoftNETTestSdkPackageVersion>15.6.0</MicrosoftNETTestSdkPackageVersion>
<MicrosoftWebAdministrationPackageVersion>7.0.0</MicrosoftWebAdministrationPackageVersion>
<SystemBuffersPackageVersion>4.5.0-preview2-26130-01</SystemBuffersPackageVersion>
<SystemIOPipelinesPackageVersion>0.1.0-preview2-180130-1</SystemIOPipelinesPackageVersion>
<SystemBuffersPackageVersion>4.5.0-preview2-26224-02</SystemBuffersPackageVersion>
<SystemIOPipelinesPackageVersion>4.5.0-preview2-26224-02</SystemIOPipelinesPackageVersion>
<SystemManagementAutomationPackageVersion>6.1.7601.17515</SystemManagementAutomationPackageVersion>
<SystemMemoryPackageVersion>4.5.0-preview2-26130-01</SystemMemoryPackageVersion>
<SystemNumericsVectorsPackageVersion>4.5.0-preview2-26130-01</SystemNumericsVectorsPackageVersion>
<SystemRuntimeCompilerServicesUnsafePackageVersion>4.5.0-preview2-26130-01</SystemRuntimeCompilerServicesUnsafePackageVersion>
<SystemSecurityPrincipalWindowsPackageVersion>4.5.0-preview2-26130-01</SystemSecurityPrincipalWindowsPackageVersion>
<SystemTextEncodingsWebUtf8PackageVersion>0.1.0-preview2-180130-1</SystemTextEncodingsWebUtf8PackageVersion>
<SystemMemoryPackageVersion>4.5.0-preview2-26224-02</SystemMemoryPackageVersion>
<SystemNumericsVectorsPackageVersion>4.5.0-preview2-26224-02</SystemNumericsVectorsPackageVersion>
<SystemRuntimeCompilerServicesUnsafePackageVersion>4.5.0-preview2-26224-02</SystemRuntimeCompilerServicesUnsafePackageVersion>
<SystemSecurityPrincipalWindowsPackageVersion>4.5.0-preview2-26224-02</SystemSecurityPrincipalWindowsPackageVersion>
<XunitPackageVersion>2.3.1</XunitPackageVersion>
<XunitRunnerVisualStudioPackageVersion>2.4.0-beta.1.build3945</XunitRunnerVisualStudioPackageVersion>
</PropertyGroup>

View File

@ -13,7 +13,6 @@
<PackageReference Include="System.Numerics.Vectors" Version="$(SystemNumericsVectorsPackageVersion)" />
<PackageReference Include="System.Buffers" Version="$(SystemBuffersPackageVersion)" />
<PackageReference Include="System.IO.Pipelines" Version="$(SystemIOPipelinesPackageVersion)" />
<PackageReference Include="System.Text.Encodings.Web.Utf8" Version="$(SystemTextEncodingsWebUtf8PackageVersion)" />
<PackageReference Include="System.Memory" Version="$(SystemMemoryPackageVersion)" />
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="$(SystemRuntimeCompilerServicesUnsafePackageVersion)" />
<PackageReference Include="System.Security.Principal.Windows" Version="$(SystemSecurityPrincipalWindowsPackageVersion)" />
@ -23,6 +22,7 @@
<PackageReference Include="Microsoft.AspNetCore.Http.Extensions" Version="$(MicrosoftAspNetCoreHttpExtensionsPackageVersion)" />
<PackageReference Include="Microsoft.AspNetCore.HttpOverrides" Version="$(MicrosoftAspNetCoreHttpOverridesPackageVersion)" />
<PackageReference Include="Microsoft.AspNetCore.HttpSys.Sources" PrivateAssets="All" Version="$(MicrosoftAspNetCoreHttpSysSourcesPackageVersion)" />
<PackageReference Include="Microsoft.Extensions.Buffers.Sources" PrivateAssets="All" Version="$(MicrosoftExtensionsBuffersSourcesPackageVersion)" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="$(MicrosoftExtensionsLoggingAbstractionsPackageVersion)" />
<PackageReference Include="Microsoft.Extensions.Options" Version="$(MicrosoftExtensionsOptionsPackageVersion)" />
<PackageReference Include="Microsoft.Extensions.SecurityHelper.Sources" PrivateAssets="All" Version="$(MicrosoftExtensionsSecurityHelperSourcesPackageVersion)" />

View File

@ -40,7 +40,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration
protected Stack<KeyValuePair<Func<object, Task>, object>> _onCompleted;
protected Exception _applicationException;
private readonly MemoryPool _memoryPool;
private readonly MemoryPool<byte> _memoryPool;
private GCHandle _thisHandle;
private MemoryHandle _inputHandle;
@ -63,7 +63,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration
private const string NegotiateString = "Negotiate";
private const string BasicString = "Basic";
internal unsafe IISHttpContext(MemoryPool memoryPool, IntPtr pInProcessHandler, IISOptions options)
internal unsafe IISHttpContext(MemoryPool<byte> memoryPool, IntPtr pInProcessHandler, IISOptions options)
: base((HttpApiTypes.HTTP_REQUEST*)NativeMethods.http_get_raw_request(pInProcessHandler))
{
_thisHandle = GCHandle.Alloc(this);
@ -467,13 +467,12 @@ namespace Microsoft.AspNetCore.Server.IISIntegration
}
finally
{
Input.Writer.Commit();
_inputHandle.Dispose();
}
var result = await Input.Writer.FlushAsync();
if (result.IsCompleted || result.IsCancelled)
if (result.IsCompleted || result.IsCanceled)
{
break;
}
@ -516,7 +515,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration
try
{
if (result.IsCancelled)
if (result.IsCanceled)
{
break;
}
@ -561,7 +560,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration
Output.Reader.Complete();
}
private unsafe IISAwaitable WriteAsync(ReadOnlyBuffer<byte> buffer)
private unsafe IISAwaitable WriteAsync(ReadOnlySequence<byte> buffer)
{
var fCompletionExpected = false;
var hr = 0;

View File

@ -14,7 +14,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration
{
private readonly IHttpApplication<TContext> _application;
public IISHttpContextOfT(MemoryPool memoryPool, IHttpApplication<TContext> application, IntPtr pInProcessHandler, IISOptions options)
public IISHttpContextOfT(MemoryPool<byte> memoryPool, IHttpApplication<TContext> application, IntPtr pInProcessHandler, IISOptions options)
: base(memoryPool, pInProcessHandler, options)
{
_application = application;

View File

@ -23,7 +23,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration
private static NativeMethods.PFN_ASYNC_COMPLETION _onAsyncCompletion = OnAsyncCompletion;
private IISContextFactory _iisContextFactory;
private readonly MemoryPool _memoryPool = new MemoryPool();
private readonly MemoryPool<byte> _memoryPool = new SlabMemoryPool();
private GCHandle _httpServerHandle;
private readonly IApplicationLifetime _applicationLifetime;
private readonly IAuthenticationSchemeProvider _authentication;
@ -119,10 +119,10 @@ namespace Microsoft.AspNetCore.Server.IISIntegration
private class IISContextFactory<T> : IISContextFactory
{
private readonly IHttpApplication<T> _application;
private readonly MemoryPool _memoryPool;
private readonly MemoryPool<byte> _memoryPool;
private readonly IISOptions _options;
public IISContextFactory(MemoryPool memoryPool, IHttpApplication<T> application, IISOptions options)
public IISContextFactory(MemoryPool<byte> memoryPool, IHttpApplication<T> application, IISOptions options)
{
_application = application;
_memoryPool = memoryPool;

View File

@ -99,7 +99,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration
return FlushAsyncAwaited(awaitable, cancellationToken);
}
private async Task FlushAsyncAwaited(ValueAwaiter<FlushResult> awaitable, CancellationToken cancellationToken)
private async Task FlushAsyncAwaited(PipeAwaiter<FlushResult> awaitable, CancellationToken cancellationToken)
{
// https://github.com/dotnet/corefxlab/issues/1334
// Since the flush awaitable doesn't currently support multiple awaiters