Don't touch product repos
This commit is contained in:
parent
350310aa96
commit
8e9f05b902
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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<byte> 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<int> ReadAsync(Memory<byte> 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<byte> 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<byte> source, CancellationToken cancellationToken = default)
|
||||
{
|
||||
Log("WriteAsync", source.Span);
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Adapter.Internal
|
|||
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)
|
||||
{
|
||||
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<byte> 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;
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
|
|||
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)
|
||||
{
|
||||
ValidateState(cancellationToken);
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
|
|||
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)
|
||||
{
|
||||
ValidateState(cancellationToken);
|
||||
|
|
|
|||
|
|
@ -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<byte>) 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();
|
||||
|
|
|
|||
|
|
@ -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<ITlsApplicationProtocolFeature>(feature);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal
|
|||
|
||||
public SocketAwaitable ReceiveAsync(Memory<byte> buffer)
|
||||
{
|
||||
#if NETCOREAPP2_2
|
||||
#if NETCOREAPP2_1
|
||||
_eventArgs.SetBuffer(buffer);
|
||||
#else
|
||||
var segment = buffer.GetArray();
|
||||
|
|
|
|||
|
|
@ -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<byte>.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();
|
||||
|
|
|
|||
Loading…
Reference in New Issue