React to pipeline changes (#1969)

This commit is contained in:
Pavel Krymets 2017-07-26 15:51:06 -07:00 committed by GitHub
parent d64238e937
commit fd6617d101
7 changed files with 14 additions and 12 deletions

View File

@ -105,7 +105,8 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Adapter.Internal
{
if (!readableBuffer.IsEmpty)
{
var count = Math.Min(readableBuffer.Length, buffer.Count);
// buffer.Count is int
var count = (int) Math.Min(readableBuffer.Length, buffer.Count);
readableBuffer = readableBuffer.Slice(0, count);
readableBuffer.CopyTo(buffer);
return count;

View File

@ -423,12 +423,12 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal
}
}
public void BytesRead(int count)
public void BytesRead(long count)
{
Interlocked.Add(ref _readTimingBytesRead, count);
}
public void StartTimingWrite(int size)
public void StartTimingWrite(long size)
{
lock (_writeTimingLock)
{

View File

@ -147,7 +147,8 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
{
if (!readableBuffer.IsEmpty)
{
var actual = Math.Min(readableBuffer.Length, buffer.Count);
// buffer.Count is int
var actual = (int) Math.Min(readableBuffer.Length, buffer.Count);
var slice = readableBuffer.Slice(0, actual);
consumed = readableBuffer.Move(readableBuffer.Start, actual);
slice.CopyTo(buffer);
@ -476,7 +477,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
// "7FFFFFFF\r\n" is the largest chunk size that could be returned as an int.
private const int MaxChunkPrefixBytes = 10;
private int _inputLength;
private long _inputLength;
private long _consumedBytes;
private Mode _mode = Mode.Prefix;
@ -568,7 +569,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
return _mode == Mode.Complete;
}
private void AddAndCheckConsumedBytes(int consumedBytes)
private void AddAndCheckConsumedBytes(long consumedBytes)
{
_consumedBytes += consumedBytes;

View File

@ -155,7 +155,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
return FlushAsyncAwaited(awaitable, writableBuffer.BytesWritten, cancellationToken);
}
private async Task FlushAsyncAwaited(WritableBufferAwaitable awaitable, int count, CancellationToken cancellationToken)
private async Task FlushAsyncAwaited(WritableBufferAwaitable awaitable, long count, CancellationToken cancellationToken)
{
// https://github.com/dotnet/corefxlab/issues/1334
// Since the flush awaitable doesn't currently support multiple awaiters

View File

@ -15,9 +15,9 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure
void PauseTimingReads();
void ResumeTimingReads();
void StopTimingReads();
void BytesRead(int count);
void BytesRead(long count);
void StartTimingWrite(int size);
void StartTimingWrite(long size);
void StopTimingWrite();
}
}

View File

@ -37,11 +37,11 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Performance.Mocks
{
}
public void BytesRead(int count)
public void BytesRead(long count)
{
}
public void StartTimingWrite(int size)
public void StartTimingWrite(long size)
{
}

View File

@ -38,7 +38,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Performance
var reading = Task.Run(async () =>
{
int remaining = InnerLoopCount * _writeLenght;
long remaining = InnerLoopCount * _writeLenght;
while (remaining != 0)
{
var result = await _pipe.Reader.ReadAsync();