diff --git a/src/Microsoft.Extensions.WebSockets.Internal/WebSocketConnection.cs b/src/Microsoft.Extensions.WebSockets.Internal/WebSocketConnection.cs index 4942fdef2b..cbd46d17cf 100644 --- a/src/Microsoft.Extensions.WebSockets.Internal/WebSocketConnection.cs +++ b/src/Microsoft.Extensions.WebSockets.Internal/WebSocketConnection.cs @@ -585,7 +585,7 @@ namespace Microsoft.Extensions.WebSockets.Internal private static void PingPayloadWriter(WritableBuffer output, Span maskingKey, int payloadLength, DateTime timestamp) { - var payload = output.Memory.Slice(0, payloadLength); + var payload = output.Buffer.Slice(0, payloadLength); // TODO: Don't put this string on the heap? Is there a way to do that without re-implementing ToString? // Ideally we'd like to render the string directly to the output buffer. @@ -615,7 +615,7 @@ namespace Microsoft.Extensions.WebSockets.Internal private static void CloseResultPayloadWriter(WritableBuffer output, Span maskingKey, int payloadLength, WebSocketCloseResult result) { // Write the close payload out - var payload = output.Memory.Slice(0, payloadLength).Span; + var payload = output.Buffer.Slice(0, payloadLength).Span; result.WriteTo(ref output); if (maskingKey.Length > 0) @@ -666,7 +666,7 @@ namespace Microsoft.Extensions.WebSockets.Internal // Allocate a buffer buffer = _outbound.Alloc(minimumSize: allocSize); - Debug.Assert(buffer.Memory.Length >= allocSize); + Debug.Assert(buffer.Buffer.Length >= allocSize); // Write the opcode and FIN flag var opcodeByte = (byte)opcode; @@ -683,7 +683,7 @@ namespace Microsoft.Extensions.WebSockets.Internal if (_maskingKeyBuffer != null) { // Get a span of the output buffer for the masking key, write it there, then advance the write head. - maskingKey = buffer.Memory.Slice(0, 4).Span; + maskingKey = buffer.Buffer.Slice(0, 4).Span; WriteMaskingKey(maskingKey); buffer.Advance(4); } diff --git a/test/Microsoft.AspNetCore.Sockets.Tests/TestWebSocketConnectionFeature.cs b/test/Microsoft.AspNetCore.Sockets.Tests/TestWebSocketConnectionFeature.cs index 9352cb4494..7d7b6fdb1c 100644 --- a/test/Microsoft.AspNetCore.Sockets.Tests/TestWebSocketConnectionFeature.cs +++ b/test/Microsoft.AspNetCore.Sockets.Tests/TestWebSocketConnectionFeature.cs @@ -1,5 +1,5 @@ using System; -using System.Buffers.Pools; +using System.Buffers; using System.IO.Pipelines; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; @@ -10,7 +10,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests { internal class TestWebSocketConnectionFeature : IHttpWebSocketConnectionFeature, IDisposable { - private PipeFactory _factory = new PipeFactory(ManagedBufferPool.Shared); + private PipeFactory _factory = new PipeFactory(BufferPool.Default); public bool IsWebSocketRequest => true;