diff --git a/build/dependencies.props b/build/dependencies.props
index f7d40ed0b3..c0382cb797 100644
--- a/build/dependencies.props
+++ b/build/dependencies.props
@@ -22,16 +22,16 @@
2.1.0-preview2-30187
2.1.0-preview2-30187
2.1.0-preview2-30187
- 2.1.0-preview2-30187
+ 2.1.0-preview2-t000
2.1.0-preview2-30187
2.1.0-preview2-30187
0.5.0-preview2-30187
- 2.1.0-preview2-30187
+ 2.1.0-preview2-t000
2.1.0-preview2-30187
2.1.0-preview2-30187
2.1.0-preview2-30187
2.1.0-preview2-30187
- 4.5.0-preview2-26130-01
+ 4.5.0-preview2-26224-02
2.1.0-preview2-30187
2.1.0-preview2-30187
2.1.0-preview2-30187
@@ -53,22 +53,21 @@
2.1.0-preview2-30187
2.1.0-preview2-30187
2.0.0
- 2.1.0-preview2-26130-04
+ 2.1.0-preview2-26225-03
15.6.0
4.7.49
1.0.0-rc
10.0.1
1.2.4
- 4.5.0-preview2-26130-01
- 0.1.0-preview2-180130-1
- 0.1.0-preview2-180130-1
- 4.5.0-preview2-26130-01
- 4.5.0-preview2-26130-01
+ 4.5.0-preview2-26224-02
+ 4.5.0-preview2-26224-02
+ 4.5.0-preview2-26224-02
+ 4.5.0-preview2-26224-02
3.1.1
4.3.0
- 4.5.0-preview2-26130-01
- 4.5.0-preview2-26130-01
- 4.5.0-preview2-26130-01
+ 4.5.0-preview2-26224-02
+ 4.5.0-preview2-26224-02
+ 4.5.0-preview2-26224-02
2.3.1
2.4.0-beta.1.build3945
diff --git a/client-ts/FunctionalTests/EchoEndPoint.cs b/client-ts/FunctionalTests/EchoEndPoint.cs
index 27460590eb..9a954db666 100644
--- a/client-ts/FunctionalTests/EchoEndPoint.cs
+++ b/client-ts/FunctionalTests/EchoEndPoint.cs
@@ -1,7 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-using System.IO.Pipelines;
+using System.Buffers;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Protocols;
using Microsoft.AspNetCore.Sockets;
diff --git a/samples/SocialWeather/SocialWeatherEndPoint.cs b/samples/SocialWeather/SocialWeatherEndPoint.cs
index 38eaf60752..192f6570b5 100644
--- a/samples/SocialWeather/SocialWeatherEndPoint.cs
+++ b/samples/SocialWeather/SocialWeatherEndPoint.cs
@@ -1,6 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+using System.Buffers;
using System.IO;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Protocols;
diff --git a/samples/SocketsSample/EndPoints/MessagesEndPoint.cs b/samples/SocketsSample/EndPoints/MessagesEndPoint.cs
index 933e50fd73..285c3a8212 100644
--- a/samples/SocketsSample/EndPoints/MessagesEndPoint.cs
+++ b/samples/SocketsSample/EndPoints/MessagesEndPoint.cs
@@ -1,6 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+using System.Buffers;
using System.Collections.Generic;
using System.IO.Pipelines;
using System.Text;
@@ -64,10 +65,11 @@ namespace SocketsSample.EndPoints
private Task Broadcast(byte[] payload)
{
var tasks = new List(Connections.Count);
+ async Task ToTask(PipeAwaiter awaiter) => await awaiter;
foreach (var c in Connections)
{
- tasks.Add(c.Transport.Output.WriteAsync(payload));
+ tasks.Add(ToTask(c.Transport.Output.WriteAsync(payload)));
}
return Task.WhenAll(tasks);
diff --git a/src/Common/StreamExtensions.cs b/src/Common/StreamExtensions.cs
index ba3d9b7e08..ad801470c2 100644
--- a/src/Common/StreamExtensions.cs
+++ b/src/Common/StreamExtensions.cs
@@ -11,7 +11,7 @@ namespace System.IO
{
internal static class StreamExtensions
{
- public static async Task WriteAsync(this Stream stream, ReadOnlyBuffer buffer, CancellationToken cancellationToken = default)
+ public static async Task WriteAsync(this Stream stream, ReadOnlySequence buffer, CancellationToken cancellationToken = default)
{
// REVIEW: Should we special case IsSingleSegment here?
foreach (var segment in buffer)
diff --git a/src/Common/WebSocketExtensions.cs b/src/Common/WebSocketExtensions.cs
index ba674f2223..dbbe798c21 100644
--- a/src/Common/WebSocketExtensions.cs
+++ b/src/Common/WebSocketExtensions.cs
@@ -14,7 +14,7 @@ namespace System.Net.WebSockets
{
internal static class WebSocketExtensions
{
- public static Task SendAsync(this WebSocket webSocket, ReadOnlyBuffer buffer, WebSocketMessageType webSocketMessageType, CancellationToken cancellationToken = default)
+ public static Task SendAsync(this WebSocket webSocket, ReadOnlySequence buffer, WebSocketMessageType webSocketMessageType, CancellationToken cancellationToken = default)
{
// TODO: Consider chunking writes here if we get a multi segment buffer
#if NETCOREAPP2_1
diff --git a/src/Microsoft.AspNetCore.SignalR.Common/Internal/HubProtocolReaderWriter.cs b/src/Microsoft.AspNetCore.SignalR.Common/Internal/HubProtocolReaderWriter.cs
index f633cab095..f2ea899282 100644
--- a/src/Microsoft.AspNetCore.SignalR.Common/Internal/HubProtocolReaderWriter.cs
+++ b/src/Microsoft.AspNetCore.SignalR.Common/Internal/HubProtocolReaderWriter.cs
@@ -22,7 +22,7 @@ namespace Microsoft.AspNetCore.SignalR.Internal
_dataEncoder = dataEncoder;
}
- public bool ReadMessages(ReadOnlyBuffer buffer, IInvocationBinder binder, out IList messages, out SequencePosition consumed, out SequencePosition examined)
+ public bool ReadMessages(ReadOnlySequence buffer, IInvocationBinder binder, out IList messages, out SequencePosition consumed, out SequencePosition examined)
{
// TODO: Fix this implementation to be incremental
consumed = buffer.End;
diff --git a/src/Microsoft.AspNetCore.SignalR.Common/Internal/Protocol/NegotiationProtocol.cs b/src/Microsoft.AspNetCore.SignalR.Common/Internal/Protocol/NegotiationProtocol.cs
index 8428073934..95e3d44acf 100644
--- a/src/Microsoft.AspNetCore.SignalR.Common/Internal/Protocol/NegotiationProtocol.cs
+++ b/src/Microsoft.AspNetCore.SignalR.Common/Internal/Protocol/NegotiationProtocol.cs
@@ -56,7 +56,7 @@ namespace Microsoft.AspNetCore.SignalR.Internal.Protocol
return true;
}
- public static bool TryParseMessage(ReadOnlyBuffer buffer, out NegotiationMessage negotiationMessage, out SequencePosition consumed, out SequencePosition examined)
+ public static bool TryParseMessage(ReadOnlySequence buffer, out NegotiationMessage negotiationMessage, out SequencePosition consumed, out SequencePosition examined)
{
var separator = buffer.PositionOf(TextMessageFormatter.RecordSeparator);
if (separator == null)
diff --git a/src/Microsoft.AspNetCore.SignalR.Common/Microsoft.AspNetCore.SignalR.Common.csproj b/src/Microsoft.AspNetCore.SignalR.Common/Microsoft.AspNetCore.SignalR.Common.csproj
index bf9c4302e2..5a33158164 100644
--- a/src/Microsoft.AspNetCore.SignalR.Common/Microsoft.AspNetCore.SignalR.Common.csproj
+++ b/src/Microsoft.AspNetCore.SignalR.Common/Microsoft.AspNetCore.SignalR.Common.csproj
@@ -11,7 +11,6 @@
-
diff --git a/src/Microsoft.AspNetCore.Sockets.Client.Http/HttpConnection.cs b/src/Microsoft.AspNetCore.Sockets.Client.Http/HttpConnection.cs
index fb52860572..2bc1698484 100644
--- a/src/Microsoft.AspNetCore.Sockets.Client.Http/HttpConnection.cs
+++ b/src/Microsoft.AspNetCore.Sockets.Client.Http/HttpConnection.cs
@@ -2,6 +2,7 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
+using System.Buffers;
using System.Collections.Generic;
using System.IO;
using System.IO.Pipelines;
diff --git a/src/Microsoft.AspNetCore.Sockets.Client.Http/Internal/StreamExtensions.cs b/src/Microsoft.AspNetCore.Sockets.Client.Http/Internal/StreamExtensions.cs
index b0152f6c7d..7c746010dc 100644
--- a/src/Microsoft.AspNetCore.Sockets.Client.Http/Internal/StreamExtensions.cs
+++ b/src/Microsoft.AspNetCore.Sockets.Client.Http/Internal/StreamExtensions.cs
@@ -38,12 +38,12 @@ namespace System.IO.Pipelines
}
///
- /// Copies a to a asynchronously
+ /// Copies a to a asynchronously
///
- /// The to copy
+ /// The to copy
/// The target
///
- public static Task CopyToAsync(this ReadOnlyBuffer buffer, Stream stream)
+ public static Task CopyToAsync(this ReadOnlySequence buffer, Stream stream)
{
if (buffer.IsSingleSegment)
{
@@ -53,7 +53,7 @@ namespace System.IO.Pipelines
return CopyMultipleToStreamAsync(buffer, stream);
}
- private static async Task CopyMultipleToStreamAsync(this ReadOnlyBuffer buffer, Stream stream)
+ private static async Task CopyMultipleToStreamAsync(this ReadOnlySequence buffer, Stream stream)
{
foreach (var memory in buffer)
{
diff --git a/src/Microsoft.AspNetCore.Sockets.Client.Http/SendUtils.cs b/src/Microsoft.AspNetCore.Sockets.Client.Http/SendUtils.cs
index 5c1a8830fa..dceeec5f39 100644
--- a/src/Microsoft.AspNetCore.Sockets.Client.Http/SendUtils.cs
+++ b/src/Microsoft.AspNetCore.Sockets.Client.Http/SendUtils.cs
@@ -42,7 +42,7 @@ namespace Microsoft.AspNetCore.Sockets.Client
var request = new HttpRequestMessage(HttpMethod.Post, sendUrl);
PrepareHttpRequest(request, httpOptions);
- request.Content = new ReadOnlyBufferContent(buffer);
+ request.Content = new ReadOnlySequenceContent(buffer);
var response = await httpClient.SendAsync(request, transportCts.Token);
response.EnsureSuccessStatusCode();
@@ -99,11 +99,11 @@ namespace Microsoft.AspNetCore.Sockets.Client
}
}
- private class ReadOnlyBufferContent : HttpContent
+ private class ReadOnlySequenceContent : HttpContent
{
- private readonly ReadOnlyBuffer _buffer;
+ private readonly ReadOnlySequence _buffer;
- public ReadOnlyBufferContent(ReadOnlyBuffer buffer)
+ public ReadOnlySequenceContent(ReadOnlySequence buffer)
{
_buffer = buffer;
}
diff --git a/src/Microsoft.AspNetCore.Sockets.Client.Http/ServerSentEventsMessageParser.cs b/src/Microsoft.AspNetCore.Sockets.Client.Http/ServerSentEventsMessageParser.cs
index 633b54945a..fa9b957284 100644
--- a/src/Microsoft.AspNetCore.Sockets.Client.Http/ServerSentEventsMessageParser.cs
+++ b/src/Microsoft.AspNetCore.Sockets.Client.Http/ServerSentEventsMessageParser.cs
@@ -3,10 +3,7 @@
using System;
using System.Buffers;
-using System.Collections;
using System.Collections.Generic;
-using System.Collections.Sequences;
-using System.IO.Pipelines;
using System.Runtime.CompilerServices;
using System.Text;
@@ -25,7 +22,7 @@ namespace Microsoft.AspNetCore.Sockets.Internal.Formatters
private InternalParseState _internalParserState = InternalParseState.ReadMessagePayload;
private List _data = new List();
- public ParseResult ParseMessage(ReadOnlyBuffer buffer, out SequencePosition consumed, out SequencePosition examined, out byte[] message)
+ public ParseResult ParseMessage(ReadOnlySequence buffer, out SequencePosition consumed, out SequencePosition examined, out byte[] message)
{
consumed = buffer.Start;
examined = buffer.End;
@@ -149,7 +146,7 @@ namespace Microsoft.AspNetCore.Sockets.Internal.Formatters
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- private ReadOnlySpan ConvertBufferToSpan(ReadOnlyBuffer buffer)
+ private ReadOnlySpan ConvertBufferToSpan(ReadOnlySequence buffer)
{
if (buffer.IsSingleSegment)
{
diff --git a/src/Microsoft.AspNetCore.Sockets.Client.Http/ServerSentEventsTransport.cs b/src/Microsoft.AspNetCore.Sockets.Client.Http/ServerSentEventsTransport.cs
index f0b6c0be7c..45cc953771 100644
--- a/src/Microsoft.AspNetCore.Sockets.Client.Http/ServerSentEventsTransport.cs
+++ b/src/Microsoft.AspNetCore.Sockets.Client.Http/ServerSentEventsTransport.cs
@@ -93,7 +93,7 @@ namespace Microsoft.AspNetCore.Sockets.Client
{
var result = await pipelineReader.ReadAsync();
var input = result.Buffer;
- if (result.IsCancelled || (input.IsEmpty && result.IsCompleted))
+ if (result.IsCanceled || (input.IsEmpty && result.IsCompleted))
{
_logger.EventStreamEnded();
break;
diff --git a/src/Microsoft.AspNetCore.Sockets.Client.Http/WebSocketsTransport.cs b/src/Microsoft.AspNetCore.Sockets.Client.Http/WebSocketsTransport.cs
index 047117a847..b56dc2dd18 100644
--- a/src/Microsoft.AspNetCore.Sockets.Client.Http/WebSocketsTransport.cs
+++ b/src/Microsoft.AspNetCore.Sockets.Client.Http/WebSocketsTransport.cs
@@ -177,7 +177,7 @@ namespace Microsoft.AspNetCore.Sockets.Client
// We canceled in the middle of applying back pressure
// or if the consumer is done
- if (flushResult.IsCancelled || flushResult.IsCompleted)
+ if (flushResult.IsCanceled || flushResult.IsCompleted)
{
break;
}
@@ -228,7 +228,7 @@ namespace Microsoft.AspNetCore.Sockets.Client
try
{
- if (result.IsCancelled)
+ if (result.IsCanceled)
{
break;
}
diff --git a/src/Microsoft.AspNetCore.Sockets.Http/Internal/Transports/ServerSentEventsMessageFormatter.cs b/src/Microsoft.AspNetCore.Sockets.Http/Internal/Transports/ServerSentEventsMessageFormatter.cs
index 2ca5123fab..bc6f382ad3 100644
--- a/src/Microsoft.AspNetCore.Sockets.Http/Internal/Transports/ServerSentEventsMessageFormatter.cs
+++ b/src/Microsoft.AspNetCore.Sockets.Http/Internal/Transports/ServerSentEventsMessageFormatter.cs
@@ -17,7 +17,7 @@ namespace Microsoft.AspNetCore.Sockets.Internal.Formatters
private const byte LineFeed = (byte)'\n';
- public static async Task WriteMessageAsync(ReadOnlyBuffer payload, Stream output)
+ public static async Task WriteMessageAsync(ReadOnlySequence payload, Stream output)
{
var ms = new MemoryStream();
diff --git a/src/Microsoft.AspNetCore.Sockets.Http/Internal/Transports/WebSocketsTransport.cs b/src/Microsoft.AspNetCore.Sockets.Http/Internal/Transports/WebSocketsTransport.cs
index a4133beb7f..01e7eb8fd2 100644
--- a/src/Microsoft.AspNetCore.Sockets.Http/Internal/Transports/WebSocketsTransport.cs
+++ b/src/Microsoft.AspNetCore.Sockets.Http/Internal/Transports/WebSocketsTransport.cs
@@ -164,7 +164,7 @@ namespace Microsoft.AspNetCore.Sockets.Internal.Transports
// We canceled in the middle of applying back pressure
// or if the consumer is done
- if (flushResult.IsCancelled || flushResult.IsCompleted)
+ if (flushResult.IsCanceled || flushResult.IsCompleted)
{
break;
}
@@ -208,7 +208,7 @@ namespace Microsoft.AspNetCore.Sockets.Internal.Transports
try
{
- if (result.IsCancelled)
+ if (result.IsCanceled)
{
break;
}
diff --git a/test/Microsoft.AspNetCore.SignalR.Client.Tests/ServerSentEventsParserTests.cs b/test/Microsoft.AspNetCore.SignalR.Client.Tests/ServerSentEventsParserTests.cs
index 5bd48aba45..8b192f1d64 100644
--- a/test/Microsoft.AspNetCore.SignalR.Client.Tests/ServerSentEventsParserTests.cs
+++ b/test/Microsoft.AspNetCore.SignalR.Client.Tests/ServerSentEventsParserTests.cs
@@ -3,9 +3,7 @@
using System;
using System.Buffers;
-using System.Collections;
using System.Collections.Generic;
-using System.Collections.Sequences;
using System.IO.Pipelines;
using System.Text;
using System.Threading.Tasks;
@@ -33,7 +31,7 @@ namespace Microsoft.AspNetCore.SignalR.Client.Tests
public void ParseSSEMessageSuccessCases(string encodedMessage, string expectedMessage)
{
var buffer = Encoding.UTF8.GetBytes(encodedMessage);
- var readableBuffer = new ReadOnlyBuffer(buffer);
+ var readableBuffer = new ReadOnlySequence(buffer);
var parser = new ServerSentEventsMessageParser();
var parseResult = parser.ParseMessage(readableBuffer, out var consumed, out var examined, out var message);
@@ -59,7 +57,7 @@ namespace Microsoft.AspNetCore.SignalR.Client.Tests
public void ParseSSEMessageFailureCases(string encodedMessage, string expectedExceptionMessage)
{
var buffer = Encoding.UTF8.GetBytes(encodedMessage);
- var readableBuffer = new ReadOnlyBuffer(buffer);
+ var readableBuffer = new ReadOnlySequence(buffer);
var parser = new ServerSentEventsMessageParser();
var ex = Assert.Throws(() => { parser.ParseMessage(readableBuffer, out var consumed, out var examined, out var message); });
@@ -87,7 +85,7 @@ namespace Microsoft.AspNetCore.SignalR.Client.Tests
public void ParseSSEMessageIncompleteParseResult(string encodedMessage)
{
var buffer = Encoding.UTF8.GetBytes(encodedMessage);
- var readableBuffer = new ReadOnlyBuffer(buffer);
+ var readableBuffer = new ReadOnlySequence(buffer);
var parser = new ServerSentEventsMessageParser();
var parseResult = parser.ParseMessage(readableBuffer, out var consumed, out var examined, out var message);
@@ -110,9 +108,7 @@ namespace Microsoft.AspNetCore.SignalR.Client.Tests
public async Task ParseMessageAcrossMultipleReadsSuccess(string[] messageParts, string expectedMessage)
{
var parser = new ServerSentEventsMessageParser();
- using (var pool = new MemoryPool())
- {
- var pipe = new Pipe(new PipeOptions(pool));
+ var pipe = new Pipe();
byte[] message = null;
SequencePosition consumed = default, examined = default;
@@ -139,7 +135,6 @@ namespace Microsoft.AspNetCore.SignalR.Client.Tests
var resultMessage = Encoding.UTF8.GetString(message);
Assert.Equal(expectedMessage, resultMessage);
- }
}
[Theory]
@@ -155,9 +150,7 @@ namespace Microsoft.AspNetCore.SignalR.Client.Tests
[InlineData("data: B\r\ndata: SGVs", "bG8sIFdvcmxk\r\n\n\n", "There was an error in the frame format")]
public async Task ParseMessageAcrossMultipleReadsFailure(string encodedMessagePart1, string encodedMessagePart2, string expectedMessage)
{
- using (var pool = new MemoryPool())
- {
- var pipe = new Pipe(new PipeOptions(pool));
+ var pipe = new Pipe();
// Read the first part of the message
await pipe.Writer.WriteAsync(Encoding.UTF8.GetBytes(encodedMessagePart1));
@@ -176,16 +169,13 @@ namespace Microsoft.AspNetCore.SignalR.Client.Tests
var ex = Assert.Throws(() => parser.ParseMessage(result.Buffer, out consumed, out examined, out buffer));
Assert.Equal(expectedMessage, ex.Message);
- }
}
[Theory]
[InlineData("data: foo\r\n\r\n", "data: bar\r\n\r\n")]
public async Task ParseMultipleMessagesText(string message1, string message2)
{
- using (var pool = new MemoryPool())
- {
- var pipe = new Pipe(new PipeOptions(pool));
+ var pipe = new Pipe();
// Read the first part of the message
await pipe.Writer.WriteAsync(Encoding.UTF8.GetBytes(message1 + message2));
@@ -207,7 +197,6 @@ namespace Microsoft.AspNetCore.SignalR.Client.Tests
Assert.Equal(ServerSentEventsMessageParser.ParseResult.Completed, parseResult);
Assert.Equal("bar", Encoding.UTF8.GetString(message));
pipe.Reader.AdvanceTo(consumed, examined);
- }
}
public static IEnumerable