From 8e9f05b90229333981149836b07f27f135f4c8bc Mon Sep 17 00:00:00 2001 From: Ryan Brandenburg Date: Tue, 8 May 2018 11:43:56 -0700 Subject: [PATCH] Don't touch product repos --- src/Kestrel.Core/Adapter/Internal/AdaptedPipeline.cs | 6 +++--- src/Kestrel.Core/Adapter/Internal/LoggingStream.cs | 8 ++++---- src/Kestrel.Core/Adapter/Internal/RawStream.cs | 6 +++--- src/Kestrel.Core/Internal/Http/HttpRequestStream.cs | 2 +- src/Kestrel.Core/Internal/Http/HttpResponseStream.cs | 2 +- src/Kestrel.Core/Internal/Http/MessageBody.cs | 4 ++-- src/Kestrel.Core/Internal/HttpsConnectionAdapter.cs | 4 ++-- src/Kestrel.Transport.Sockets/Internal/SocketReceiver.cs | 2 +- src/Kestrel.Transport.Sockets/Internal/SocketSender.cs | 4 ++-- 9 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/Kestrel.Core/Adapter/Internal/AdaptedPipeline.cs b/src/Kestrel.Core/Adapter/Internal/AdaptedPipeline.cs index 0331583b08..221c4c1b84 100644 --- a/src/Kestrel.Core/Adapter/Internal/AdaptedPipeline.cs +++ b/src/Kestrel.Core/Adapter/Internal/AdaptedPipeline.cs @@ -80,7 +80,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Adapter.Internal } else if (buffer.IsSingleSegment) { -#if NETCOREAPP2_2 +#if NETCOREAPP2_1 await stream.WriteAsync(buffer.First); #else var array = buffer.First.GetArray(); @@ -91,7 +91,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Adapter.Internal { foreach (var memory in buffer) { -#if NETCOREAPP2_2 +#if NETCOREAPP2_1 await stream.WriteAsync(memory); #else var array = memory.GetArray(); @@ -133,7 +133,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Adapter.Internal { var outputBuffer = Input.Writer.GetMemory(MinAllocBufferSize); -#if NETCOREAPP2_2 +#if NETCOREAPP2_1 var bytesRead = await stream.ReadAsync(outputBuffer); #else var array = outputBuffer.GetArray(); diff --git a/src/Kestrel.Core/Adapter/Internal/LoggingStream.cs b/src/Kestrel.Core/Adapter/Internal/LoggingStream.cs index d434179af7..f9225b6f48 100644 --- a/src/Kestrel.Core/Adapter/Internal/LoggingStream.cs +++ b/src/Kestrel.Core/Adapter/Internal/LoggingStream.cs @@ -83,7 +83,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Adapter.Internal return read; } -#if NETCOREAPP2_2 +#if NETCOREAPP2_1 public override int Read(Span destination) { int read = _inner.Read(destination); @@ -99,7 +99,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Adapter.Internal return read; } -#if NETCOREAPP2_2 +#if NETCOREAPP2_1 public override async ValueTask ReadAsync(Memory destination, CancellationToken cancellationToken = default) { int read = await _inner.ReadAsync(destination, cancellationToken); @@ -124,7 +124,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Adapter.Internal _inner.Write(buffer, offset, count); } -#if NETCOREAPP2_2 +#if NETCOREAPP2_1 public override void Write(ReadOnlySpan source) { Log("Write", source); @@ -138,7 +138,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Adapter.Internal return _inner.WriteAsync(buffer, offset, count, cancellationToken); } -#if NETCOREAPP2_2 +#if NETCOREAPP2_1 public override ValueTask WriteAsync(ReadOnlyMemory source, CancellationToken cancellationToken = default) { Log("WriteAsync", source.Span); diff --git a/src/Kestrel.Core/Adapter/Internal/RawStream.cs b/src/Kestrel.Core/Adapter/Internal/RawStream.cs index f71f5a3573..7be7d276f8 100644 --- a/src/Kestrel.Core/Adapter/Internal/RawStream.cs +++ b/src/Kestrel.Core/Adapter/Internal/RawStream.cs @@ -69,7 +69,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Adapter.Internal return ReadAsyncInternal(new Memory(buffer, offset, count)).AsTask(); } -#if NETCOREAPP2_2 +#if NETCOREAPP2_1 public override ValueTask ReadAsync(Memory destination, CancellationToken cancellationToken = default) { return ReadAsyncInternal(destination); @@ -91,7 +91,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Adapter.Internal await _output.FlushAsync(cancellationToken); } -#if NETCOREAPP2_2 +#if NETCOREAPP2_1 public override async ValueTask WriteAsync(ReadOnlyMemory source, CancellationToken cancellationToken = default) { _output.Write(source.Span); @@ -120,7 +120,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Adapter.Internal if (!readableBuffer.IsEmpty) { // 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.CopyTo(destination.Span); return count; diff --git a/src/Kestrel.Core/Internal/Http/HttpRequestStream.cs b/src/Kestrel.Core/Internal/Http/HttpRequestStream.cs index 29c025f8ad..51b7e7b6cd 100644 --- a/src/Kestrel.Core/Internal/Http/HttpRequestStream.cs +++ b/src/Kestrel.Core/Internal/Http/HttpRequestStream.cs @@ -110,7 +110,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http return ReadAsyncInternal(new Memory(buffer, offset, count), cancellationToken).AsTask(); } -#if NETCOREAPP2_2 +#if NETCOREAPP2_1 public override ValueTask ReadAsync(Memory destination, CancellationToken cancellationToken = default) { ValidateState(cancellationToken); diff --git a/src/Kestrel.Core/Internal/Http/HttpResponseStream.cs b/src/Kestrel.Core/Internal/Http/HttpResponseStream.cs index 0f2e122617..aefbe6fb19 100644 --- a/src/Kestrel.Core/Internal/Http/HttpResponseStream.cs +++ b/src/Kestrel.Core/Internal/Http/HttpResponseStream.cs @@ -111,7 +111,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http return _httpResponseControl.WriteAsync(new ReadOnlyMemory(buffer, offset, count), cancellationToken); } -#if NETCOREAPP2_2 +#if NETCOREAPP2_1 public override ValueTask WriteAsync(ReadOnlyMemory source, CancellationToken cancellationToken = default) { ValidateState(cancellationToken); diff --git a/src/Kestrel.Core/Internal/Http/MessageBody.cs b/src/Kestrel.Core/Internal/Http/MessageBody.cs index 5f27a2784d..d96aa99d47 100644 --- a/src/Kestrel.Core/Internal/Http/MessageBody.cs +++ b/src/Kestrel.Core/Internal/Http/MessageBody.cs @@ -51,7 +51,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http if (!readableBuffer.IsEmpty) { // 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); consumed = readableBuffer.GetPosition(actual); 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 // - The WriteAsync(ReadOnlyMemory) isn't overridden on the destination // - 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); #else var array = memory.GetArray(); diff --git a/src/Kestrel.Core/Internal/HttpsConnectionAdapter.cs b/src/Kestrel.Core/Internal/HttpsConnectionAdapter.cs index 4de1c64a08..301c9c7a23 100644 --- a/src/Kestrel.Core/Internal/HttpsConnectionAdapter.cs +++ b/src/Kestrel.Core/Internal/HttpsConnectionAdapter.cs @@ -126,7 +126,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Https.Internal try { -#if NETCOREAPP2_2 +#if NETCOREAPP2_1 // Adapt to the SslStream signature ServerCertificateSelectionCallback selector = null; if (_serverCertificateSelector != null) @@ -197,7 +197,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Https.Internal timeoutFeature.CancelTimeout(); } -#if NETCOREAPP2_2 +#if NETCOREAPP2_1 feature.ApplicationProtocol = sslStream.NegotiatedApplicationProtocol.Protocol; context.Features.Set(feature); #endif diff --git a/src/Kestrel.Transport.Sockets/Internal/SocketReceiver.cs b/src/Kestrel.Transport.Sockets/Internal/SocketReceiver.cs index 8de454ec3a..2116c03cd5 100644 --- a/src/Kestrel.Transport.Sockets/Internal/SocketReceiver.cs +++ b/src/Kestrel.Transport.Sockets/Internal/SocketReceiver.cs @@ -23,7 +23,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal public SocketAwaitable ReceiveAsync(Memory buffer) { -#if NETCOREAPP2_2 +#if NETCOREAPP2_1 _eventArgs.SetBuffer(buffer); #else var segment = buffer.GetArray(); diff --git a/src/Kestrel.Transport.Sockets/Internal/SocketSender.cs b/src/Kestrel.Transport.Sockets/Internal/SocketSender.cs index 9878d4a3b9..26e22b664d 100644 --- a/src/Kestrel.Transport.Sockets/Internal/SocketSender.cs +++ b/src/Kestrel.Transport.Sockets/Internal/SocketSender.cs @@ -34,7 +34,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal return SendAsync(buffers.First); } -#if NETCOREAPP2_2 +#if NETCOREAPP2_1 if (!_eventArgs.MemoryBuffer.Equals(Memory.Empty)) #else if (_eventArgs.Buffer != null) @@ -61,7 +61,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal _eventArgs.BufferList = null; } -#if NETCOREAPP2_2 +#if NETCOREAPP2_1 _eventArgs.SetBuffer(MemoryMarshal.AsMemory(memory)); #else var segment = memory.GetArray();