Reaction to *Memory changes

This commit is contained in:
Pavel Krymets 2018-03-30 16:33:09 -07:00
parent 8ea2de1dc2
commit ba7b43a391
3 changed files with 20 additions and 20 deletions

View File

@ -19,7 +19,7 @@
<MicrosoftAspNetCoreWebUtilitiesPackageVersion>2.1.0-preview2-30500</MicrosoftAspNetCoreWebUtilitiesPackageVersion>
<MicrosoftBuildFrameworkPackageVersion>15.6.82</MicrosoftBuildFrameworkPackageVersion>
<MicrosoftBuildUtilitiesCorePackageVersion>15.6.82</MicrosoftBuildUtilitiesCorePackageVersion>
<MicrosoftExtensionsBuffersSourcesPackageVersion>2.1.0-preview2-30500</MicrosoftExtensionsBuffersSourcesPackageVersion>
<MicrosoftExtensionsBuffersSourcesPackageVersion>2.1.0-preview2-t000</MicrosoftExtensionsBuffersSourcesPackageVersion>
<MicrosoftExtensionsConfigurationEnvironmentVariablesPackageVersion>2.1.0-preview2-30500</MicrosoftExtensionsConfigurationEnvironmentVariablesPackageVersion>
<MicrosoftExtensionsConfigurationJsonPackageVersion>2.1.0-preview2-30500</MicrosoftExtensionsConfigurationJsonPackageVersion>
<MicrosoftExtensionsLoggingAbstractionsPackageVersion>2.1.0-preview2-30500</MicrosoftExtensionsLoggingAbstractionsPackageVersion>
@ -35,14 +35,14 @@
<MicrosoftNetHttpHeadersPackageVersion>2.1.0-preview2-30500</MicrosoftNetHttpHeadersPackageVersion>
<MicrosoftNETTestSdkPackageVersion>15.6.1</MicrosoftNETTestSdkPackageVersion>
<MicrosoftWebAdministrationPackageVersion>7.0.0</MicrosoftWebAdministrationPackageVersion>
<SystemBuffersPackageVersion>4.5.0-preview2-26326-04</SystemBuffersPackageVersion>
<SystemIOPipelinesPackageVersion>4.5.0-preview2-26326-04</SystemIOPipelinesPackageVersion>
<SystemBuffersPackageVersion>4.5.0-preview3-26330-0</SystemBuffersPackageVersion>
<SystemIOPipelinesPackageVersion>4.5.0-preview3-26330-0</SystemIOPipelinesPackageVersion>
<SystemManagementAutomationPackageVersion>6.1.7601.17515</SystemManagementAutomationPackageVersion>
<SystemMemoryPackageVersion>4.5.0-preview2-26326-04</SystemMemoryPackageVersion>
<SystemNetWebSocketsWebSocketProtocolPackageVersion>4.5.0-preview2-26326-04</SystemNetWebSocketsWebSocketProtocolPackageVersion>
<SystemNumericsVectorsPackageVersion>4.5.0-preview2-26326-04</SystemNumericsVectorsPackageVersion>
<SystemRuntimeCompilerServicesUnsafePackageVersion>4.5.0-preview2-26326-04</SystemRuntimeCompilerServicesUnsafePackageVersion>
<SystemSecurityPrincipalWindowsPackageVersion>4.5.0-preview2-26326-04</SystemSecurityPrincipalWindowsPackageVersion>
<SystemMemoryPackageVersion>4.5.0-preview3-26330-0</SystemMemoryPackageVersion>
<SystemNetWebSocketsWebSocketProtocolPackageVersion>4.5.0-preview3-26330-0</SystemNetWebSocketsWebSocketProtocolPackageVersion>
<SystemNumericsVectorsPackageVersion>4.5.0-preview3-26330-0</SystemNumericsVectorsPackageVersion>
<SystemRuntimeCompilerServicesUnsafePackageVersion>4.5.0-preview3-26330-0</SystemRuntimeCompilerServicesUnsafePackageVersion>
<SystemSecurityPrincipalWindowsPackageVersion>4.5.0-preview3-26330-0</SystemSecurityPrincipalWindowsPackageVersion>
<Tooling_NewtonsoftJsonPackageVersion>9.0.1</Tooling_NewtonsoftJsonPackageVersion>
<XunitPackageVersion>2.3.1</XunitPackageVersion>
<XunitRunnerVisualStudioPackageVersion>2.4.0-beta.1.build3945</XunitRunnerVisualStudioPackageVersion>

View File

@ -58,7 +58,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration
internal Task WriteAsync(ReadOnlyMemory<byte> memory, CancellationToken cancellationToken = default(CancellationToken))
{
// Want to keep exceptions consistent,
// Want to keep exceptions consistent,
if (!_hasResponseStarted)
{
return WriteAsyncAwaited(memory, cancellationToken);
@ -135,7 +135,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration
await writeTask;
}
// ConsumeAsync is called when either the first read or first write is done.
// ConsumeAsync is called when either the first read or first write is done.
// There are two modes for reading and writing to the request/response bodies without upgrade.
// 1. Await all reads and try to read from the Output pipe
// 2. Done reading and await all writes.
@ -265,7 +265,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration
{
ref var handle = ref handles[currentChunk];
ref var chunk = ref pDataChunks[currentChunk];
handle = b.Retain(true);
handle = b.Pin();
chunk.DataChunkType = HttpApiTypes.HTTP_DATA_CHUNK_TYPE.HttpDataChunkFromMemory;
chunk.fromMemory.BufferLength = (uint)b.Length;
@ -281,13 +281,13 @@ namespace Microsoft.AspNetCore.Server.IISIntegration
{
handle.Dispose();
}
return hr;
}
private unsafe IISAwaitable FlushToIISAsync()
{
// Calls flush
// Calls flush
var hr = 0;
hr = NativeMethods.HttpFlushResponseBytes(_pInProcessHandler, out var fCompletionExpected);
if (!fCompletionExpected)
@ -356,9 +356,9 @@ namespace Microsoft.AspNetCore.Server.IISIntegration
return;
}
// Now we handle the read.
// Now we handle the read.
var memory = Input.Writer.GetMemory();
_inputHandle = memory.Retain(true);
_inputHandle = memory.Pin();
try
{
@ -368,7 +368,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration
// read value of 0 == done reading
// read value of -1 == read cancelled, still allowed to read but we
// need a write to occur first.
// need a write to occur first.
if (read == 0)
{
break;
@ -388,7 +388,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration
// Flush the read data for the Input Pipe writer
var flushResult = await Input.Writer.FlushAsync();
// If the pipe was closed, we are done reading,
// If the pipe was closed, we are done reading,
if (flushResult.IsCompleted || flushResult.IsCanceled)
{
break;
@ -437,7 +437,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration
}
else
{
// Flush of zero bytes will
// Flush of zero bytes will
await FlushToIISAsync();
}
}

View File

@ -110,7 +110,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration
ref var handle = ref handles[currentChunk];
ref var chunk = ref pDataChunks[currentChunk];
handle = b.Retain(true);
handle = b.Pin();
chunk.DataChunkType = HttpApiTypes.HTTP_DATA_CHUNK_TYPE.HttpDataChunkFromMemory;
chunk.fromMemory.BufferLength = (uint)b.Length;
@ -152,7 +152,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration
while (true)
{
var memory = Input.Writer.GetMemory();
_inputHandle = memory.Retain(true);
_inputHandle = memory.Pin();
try
{