Don't touch product repos

This commit is contained in:
Ryan Brandenburg 2018-05-08 11:43:56 -07:00
parent 350310aa96
commit 8e9f05b902
9 changed files with 19 additions and 19 deletions

View File

@ -80,7 +80,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Adapter.Internal
} }
else if (buffer.IsSingleSegment) else if (buffer.IsSingleSegment)
{ {
#if NETCOREAPP2_2 #if NETCOREAPP2_1
await stream.WriteAsync(buffer.First); await stream.WriteAsync(buffer.First);
#else #else
var array = buffer.First.GetArray(); var array = buffer.First.GetArray();
@ -91,7 +91,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Adapter.Internal
{ {
foreach (var memory in buffer) foreach (var memory in buffer)
{ {
#if NETCOREAPP2_2 #if NETCOREAPP2_1
await stream.WriteAsync(memory); await stream.WriteAsync(memory);
#else #else
var array = memory.GetArray(); var array = memory.GetArray();
@ -133,7 +133,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Adapter.Internal
{ {
var outputBuffer = Input.Writer.GetMemory(MinAllocBufferSize); var outputBuffer = Input.Writer.GetMemory(MinAllocBufferSize);
#if NETCOREAPP2_2 #if NETCOREAPP2_1
var bytesRead = await stream.ReadAsync(outputBuffer); var bytesRead = await stream.ReadAsync(outputBuffer);
#else #else
var array = outputBuffer.GetArray(); var array = outputBuffer.GetArray();

View File

@ -83,7 +83,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Adapter.Internal
return read; return read;
} }
#if NETCOREAPP2_2 #if NETCOREAPP2_1
public override int Read(Span<byte> destination) public override int Read(Span<byte> destination)
{ {
int read = _inner.Read(destination); int read = _inner.Read(destination);
@ -99,7 +99,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Adapter.Internal
return read; return read;
} }
#if NETCOREAPP2_2 #if NETCOREAPP2_1
public override async ValueTask<int> ReadAsync(Memory<byte> destination, CancellationToken cancellationToken = default) public override async ValueTask<int> ReadAsync(Memory<byte> destination, CancellationToken cancellationToken = default)
{ {
int read = await _inner.ReadAsync(destination, cancellationToken); int read = await _inner.ReadAsync(destination, cancellationToken);
@ -124,7 +124,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Adapter.Internal
_inner.Write(buffer, offset, count); _inner.Write(buffer, offset, count);
} }
#if NETCOREAPP2_2 #if NETCOREAPP2_1
public override void Write(ReadOnlySpan<byte> source) public override void Write(ReadOnlySpan<byte> source)
{ {
Log("Write", source); Log("Write", source);
@ -138,7 +138,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Adapter.Internal
return _inner.WriteAsync(buffer, offset, count, cancellationToken); return _inner.WriteAsync(buffer, offset, count, cancellationToken);
} }
#if NETCOREAPP2_2 #if NETCOREAPP2_1
public override ValueTask WriteAsync(ReadOnlyMemory<byte> source, CancellationToken cancellationToken = default) public override ValueTask WriteAsync(ReadOnlyMemory<byte> source, CancellationToken cancellationToken = default)
{ {
Log("WriteAsync", source.Span); Log("WriteAsync", source.Span);

View File

@ -69,7 +69,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Adapter.Internal
return ReadAsyncInternal(new Memory<byte>(buffer, offset, count)).AsTask(); return ReadAsyncInternal(new Memory<byte>(buffer, offset, count)).AsTask();
} }
#if NETCOREAPP2_2 #if NETCOREAPP2_1
public override ValueTask<int> ReadAsync(Memory<byte> destination, CancellationToken cancellationToken = default) public override ValueTask<int> ReadAsync(Memory<byte> destination, CancellationToken cancellationToken = default)
{ {
return ReadAsyncInternal(destination); return ReadAsyncInternal(destination);
@ -91,7 +91,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Adapter.Internal
await _output.FlushAsync(cancellationToken); await _output.FlushAsync(cancellationToken);
} }
#if NETCOREAPP2_2 #if NETCOREAPP2_1
public override async ValueTask WriteAsync(ReadOnlyMemory<byte> source, CancellationToken cancellationToken = default) public override async ValueTask WriteAsync(ReadOnlyMemory<byte> source, CancellationToken cancellationToken = default)
{ {
_output.Write(source.Span); _output.Write(source.Span);
@ -120,7 +120,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Adapter.Internal
if (!readableBuffer.IsEmpty) if (!readableBuffer.IsEmpty)
{ {
// buffer.Count is int // buffer.Count is int
var count = (int) Math.Min(readableBuffer.Length, destination.Length); var count = (int)Math.Min(readableBuffer.Length, destination.Length);
readableBuffer = readableBuffer.Slice(0, count); readableBuffer = readableBuffer.Slice(0, count);
readableBuffer.CopyTo(destination.Span); readableBuffer.CopyTo(destination.Span);
return count; return count;

View File

@ -110,7 +110,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
return ReadAsyncInternal(new Memory<byte>(buffer, offset, count), cancellationToken).AsTask(); return ReadAsyncInternal(new Memory<byte>(buffer, offset, count), cancellationToken).AsTask();
} }
#if NETCOREAPP2_2 #if NETCOREAPP2_1
public override ValueTask<int> ReadAsync(Memory<byte> destination, CancellationToken cancellationToken = default) public override ValueTask<int> ReadAsync(Memory<byte> destination, CancellationToken cancellationToken = default)
{ {
ValidateState(cancellationToken); ValidateState(cancellationToken);

View File

@ -111,7 +111,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
return _httpResponseControl.WriteAsync(new ReadOnlyMemory<byte>(buffer, offset, count), cancellationToken); return _httpResponseControl.WriteAsync(new ReadOnlyMemory<byte>(buffer, offset, count), cancellationToken);
} }
#if NETCOREAPP2_2 #if NETCOREAPP2_1
public override ValueTask WriteAsync(ReadOnlyMemory<byte> source, CancellationToken cancellationToken = default) public override ValueTask WriteAsync(ReadOnlyMemory<byte> source, CancellationToken cancellationToken = default)
{ {
ValidateState(cancellationToken); ValidateState(cancellationToken);

View File

@ -51,7 +51,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
if (!readableBuffer.IsEmpty) if (!readableBuffer.IsEmpty)
{ {
// buffer.Count is int // buffer.Count is int
var actual = (int) Math.Min(readableBuffer.Length, buffer.Length); var actual = (int)Math.Min(readableBuffer.Length, buffer.Length);
var slice = readableBuffer.Slice(0, actual); var slice = readableBuffer.Slice(0, actual);
consumed = readableBuffer.GetPosition(actual); consumed = readableBuffer.GetPosition(actual);
slice.CopyTo(buffer.Span); slice.CopyTo(buffer.Span);
@ -88,7 +88,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
// REVIEW: This *could* be slower if 2 things are true // REVIEW: This *could* be slower if 2 things are true
// - The WriteAsync(ReadOnlyMemory<byte>) isn't overridden on the destination // - The WriteAsync(ReadOnlyMemory<byte>) isn't overridden on the destination
// - We change the Kestrel Memory Pool to not use pinned arrays but instead use native memory // - We change the Kestrel Memory Pool to not use pinned arrays but instead use native memory
#if NETCOREAPP2_2 #if NETCOREAPP2_1
await destination.WriteAsync(memory); await destination.WriteAsync(memory);
#else #else
var array = memory.GetArray(); var array = memory.GetArray();

View File

@ -126,7 +126,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Https.Internal
try try
{ {
#if NETCOREAPP2_2 #if NETCOREAPP2_1
// Adapt to the SslStream signature // Adapt to the SslStream signature
ServerCertificateSelectionCallback selector = null; ServerCertificateSelectionCallback selector = null;
if (_serverCertificateSelector != null) if (_serverCertificateSelector != null)
@ -197,7 +197,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Https.Internal
timeoutFeature.CancelTimeout(); timeoutFeature.CancelTimeout();
} }
#if NETCOREAPP2_2 #if NETCOREAPP2_1
feature.ApplicationProtocol = sslStream.NegotiatedApplicationProtocol.Protocol; feature.ApplicationProtocol = sslStream.NegotiatedApplicationProtocol.Protocol;
context.Features.Set<ITlsApplicationProtocolFeature>(feature); context.Features.Set<ITlsApplicationProtocolFeature>(feature);
#endif #endif

View File

@ -23,7 +23,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal
public SocketAwaitable ReceiveAsync(Memory<byte> buffer) public SocketAwaitable ReceiveAsync(Memory<byte> buffer)
{ {
#if NETCOREAPP2_2 #if NETCOREAPP2_1
_eventArgs.SetBuffer(buffer); _eventArgs.SetBuffer(buffer);
#else #else
var segment = buffer.GetArray(); var segment = buffer.GetArray();

View File

@ -34,7 +34,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal
return SendAsync(buffers.First); return SendAsync(buffers.First);
} }
#if NETCOREAPP2_2 #if NETCOREAPP2_1
if (!_eventArgs.MemoryBuffer.Equals(Memory<byte>.Empty)) if (!_eventArgs.MemoryBuffer.Equals(Memory<byte>.Empty))
#else #else
if (_eventArgs.Buffer != null) if (_eventArgs.Buffer != null)
@ -61,7 +61,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal
_eventArgs.BufferList = null; _eventArgs.BufferList = null;
} }
#if NETCOREAPP2_2 #if NETCOREAPP2_1
_eventArgs.SetBuffer(MemoryMarshal.AsMemory(memory)); _eventArgs.SetBuffer(MemoryMarshal.AsMemory(memory));
#else #else
var segment = memory.GetArray(); var segment = memory.GetArray();