parent
63ce7f6160
commit
10782d59a2
|
|
@ -585,7 +585,7 @@ namespace Microsoft.Extensions.WebSockets.Internal
|
||||||
|
|
||||||
private static void PingPayloadWriter(WritableBuffer output, Span<byte> maskingKey, int payloadLength, DateTime timestamp)
|
private static void PingPayloadWriter(WritableBuffer output, Span<byte> 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?
|
// 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.
|
// 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<byte> maskingKey, int payloadLength, WebSocketCloseResult result)
|
private static void CloseResultPayloadWriter(WritableBuffer output, Span<byte> maskingKey, int payloadLength, WebSocketCloseResult result)
|
||||||
{
|
{
|
||||||
// Write the close payload out
|
// 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);
|
result.WriteTo(ref output);
|
||||||
|
|
||||||
if (maskingKey.Length > 0)
|
if (maskingKey.Length > 0)
|
||||||
|
|
@ -666,7 +666,7 @@ namespace Microsoft.Extensions.WebSockets.Internal
|
||||||
|
|
||||||
// Allocate a buffer
|
// Allocate a buffer
|
||||||
buffer = _outbound.Alloc(minimumSize: allocSize);
|
buffer = _outbound.Alloc(minimumSize: allocSize);
|
||||||
Debug.Assert(buffer.Memory.Length >= allocSize);
|
Debug.Assert(buffer.Buffer.Length >= allocSize);
|
||||||
|
|
||||||
// Write the opcode and FIN flag
|
// Write the opcode and FIN flag
|
||||||
var opcodeByte = (byte)opcode;
|
var opcodeByte = (byte)opcode;
|
||||||
|
|
@ -683,7 +683,7 @@ namespace Microsoft.Extensions.WebSockets.Internal
|
||||||
if (_maskingKeyBuffer != null)
|
if (_maskingKeyBuffer != null)
|
||||||
{
|
{
|
||||||
// Get a span of the output buffer for the masking key, write it there, then advance the write head.
|
// 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);
|
WriteMaskingKey(maskingKey);
|
||||||
buffer.Advance(4);
|
buffer.Advance(4);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Buffers.Pools;
|
using System.Buffers;
|
||||||
using System.IO.Pipelines;
|
using System.IO.Pipelines;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
|
|
@ -10,7 +10,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
|
||||||
{
|
{
|
||||||
internal class TestWebSocketConnectionFeature : IHttpWebSocketConnectionFeature, IDisposable
|
internal class TestWebSocketConnectionFeature : IHttpWebSocketConnectionFeature, IDisposable
|
||||||
{
|
{
|
||||||
private PipeFactory _factory = new PipeFactory(ManagedBufferPool.Shared);
|
private PipeFactory _factory = new PipeFactory(BufferPool.Default);
|
||||||
|
|
||||||
public bool IsWebSocketRequest => true;
|
public bool IsWebSocketRequest => true;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue