[2.2.1] Use non-pinnable buffer for zero byte read (#4066)

This commit is contained in:
Ben Adams 2018-11-17 00:18:23 +00:00 committed by Stephen Halter
parent 20f7d3be9d
commit f7c26f9912
1 changed files with 6 additions and 0 deletions

View File

@ -15,7 +15,13 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal
public SocketAwaitableEventArgs WaitForDataAsync()
{
#if NETCOREAPP2_1
_awaitableEventArgs.SetBuffer(Memory<byte>.Empty);
#elif NETSTANDARD2_0
_awaitableEventArgs.SetBuffer(Array.Empty<byte>(), 0, 0);
#else
#error TFMs need to be updated
#endif
if (!_socket.ReceiveAsync(_awaitableEventArgs))
{