diff --git a/build/common.props b/build/common.props index 41472e3449..f4c436185e 100644 --- a/build/common.props +++ b/build/common.props @@ -1,4 +1,5 @@ + @@ -8,8 +9,6 @@ $(MSBuildThisFileDirectory)Key.snk true true - 1.2.0-* - 1.6.2-* $(VersionSuffix)-$(BuildNumber) diff --git a/build/dependencies.props b/build/dependencies.props new file mode 100644 index 0000000000..b89944d9f4 --- /dev/null +++ b/build/dependencies.props @@ -0,0 +1,7 @@ + + + 1.6.1 + 4.3.0 + 0.1.0-* + + diff --git a/samples/ChatSample/ChatSample.csproj b/samples/ChatSample/ChatSample.csproj index 5eb3b34414..a2656660e3 100644 --- a/samples/ChatSample/ChatSample.csproj +++ b/samples/ChatSample/ChatSample.csproj @@ -8,7 +8,6 @@ Exe aspnet-ChatSample-f11cf018-e0a8-49fa-b749-4c0eb5c9150b $(PackageTargetFallback);portable-net45+win8 - 1.2.0-* false diff --git a/samples/ClientSample/ClientSample.csproj b/samples/ClientSample/ClientSample.csproj index db1240c79d..93669140bd 100644 --- a/samples/ClientSample/ClientSample.csproj +++ b/samples/ClientSample/ClientSample.csproj @@ -5,7 +5,6 @@ netcoreapp1.1 Exe - 1.2.0-* false @@ -13,7 +12,7 @@ - + diff --git a/samples/SocialWeather/SocialWeather.csproj b/samples/SocialWeather/SocialWeather.csproj index 273c5c8984..767686aca7 100644 --- a/samples/SocialWeather/SocialWeather.csproj +++ b/samples/SocialWeather/SocialWeather.csproj @@ -6,7 +6,6 @@ netcoreapp1.1 true Exe - 1.2.0-* false diff --git a/samples/SocketsSample/SocketsSample.csproj b/samples/SocketsSample/SocketsSample.csproj index 481c258242..a94772835a 100644 --- a/samples/SocketsSample/SocketsSample.csproj +++ b/samples/SocketsSample/SocketsSample.csproj @@ -9,7 +9,6 @@ true Exe $(PackageTargetFallback);portable-net45+win8+wp8+wpa81 - 1.2.0-* false diff --git a/samples/WebSocketSample/WebSocketSample.csproj b/samples/WebSocketSample/WebSocketSample.csproj index c6d9bb267f..10a46ba6cd 100644 --- a/samples/WebSocketSample/WebSocketSample.csproj +++ b/samples/WebSocketSample/WebSocketSample.csproj @@ -1,5 +1,7 @@  + + netcoreapp1.1 Exe @@ -9,7 +11,7 @@ - + diff --git a/src/Microsoft.AspNetCore.Sockets.Client/Microsoft.AspNetCore.Sockets.Client.csproj b/src/Microsoft.AspNetCore.Sockets.Client/Microsoft.AspNetCore.Sockets.Client.csproj index ee35f9d6bf..d4f788b180 100644 --- a/src/Microsoft.AspNetCore.Sockets.Client/Microsoft.AspNetCore.Sockets.Client.csproj +++ b/src/Microsoft.AspNetCore.Sockets.Client/Microsoft.AspNetCore.Sockets.Client.csproj @@ -1,5 +1,7 @@  + + Client for ASP.NET Core SignalR netstandard1.3 @@ -7,12 +9,17 @@ true aspnetcore;signalr + - - + + + - + + + - \ No newline at end of file + + diff --git a/src/Microsoft.AspNetCore.Sockets.Common/Message.cs b/src/Microsoft.AspNetCore.Sockets.Common/Message.cs index 10b8298d01..2413b5eb3e 100644 --- a/src/Microsoft.AspNetCore.Sockets.Common/Message.cs +++ b/src/Microsoft.AspNetCore.Sockets.Common/Message.cs @@ -3,8 +3,6 @@ using System; using System.IO.Pipelines; -using System.Text; -using System.Text.Formatting; namespace Microsoft.AspNetCore.Sockets { diff --git a/src/Microsoft.AspNetCore.Sockets.Common/Microsoft.AspNetCore.Sockets.Common.csproj b/src/Microsoft.AspNetCore.Sockets.Common/Microsoft.AspNetCore.Sockets.Common.csproj index acad5ab6d9..a0b5414476 100644 --- a/src/Microsoft.AspNetCore.Sockets.Common/Microsoft.AspNetCore.Sockets.Common.csproj +++ b/src/Microsoft.AspNetCore.Sockets.Common/Microsoft.AspNetCore.Sockets.Common.csproj @@ -11,9 +11,9 @@ - - - + + + diff --git a/src/Microsoft.AspNetCore.Sockets/Microsoft.AspNetCore.Sockets.csproj b/src/Microsoft.AspNetCore.Sockets/Microsoft.AspNetCore.Sockets.csproj index 1609d2483a..c79342d9dc 100644 --- a/src/Microsoft.AspNetCore.Sockets/Microsoft.AspNetCore.Sockets.csproj +++ b/src/Microsoft.AspNetCore.Sockets/Microsoft.AspNetCore.Sockets.csproj @@ -17,9 +17,9 @@ - - - + + + diff --git a/src/Microsoft.AspNetCore.WebSockets.Internal/WebSocketAppBuilderExtensions.cs b/src/Microsoft.AspNetCore.WebSockets.Internal/WebSocketAppBuilderExtensions.cs index 6b6223d504..9e67d48f66 100644 --- a/src/Microsoft.AspNetCore.WebSockets.Internal/WebSocketAppBuilderExtensions.cs +++ b/src/Microsoft.AspNetCore.WebSockets.Internal/WebSocketAppBuilderExtensions.cs @@ -12,10 +12,10 @@ namespace Microsoft.AspNetCore.Builder public static void UseWebSocketConnections(this IApplicationBuilder app) { // Only the GC can clean up this channel factory :( - app.UseWebSocketConnections(new PipelineFactory(), new WebSocketConnectionOptions()); + app.UseWebSocketConnections(new PipeFactory(), new WebSocketConnectionOptions()); } - public static void UseWebSocketConnections(this IApplicationBuilder app, PipelineFactory factory) + public static void UseWebSocketConnections(this IApplicationBuilder app, PipeFactory factory) { if (factory == null) { @@ -24,7 +24,7 @@ namespace Microsoft.AspNetCore.Builder app.UseWebSocketConnections(factory, new WebSocketConnectionOptions()); } - public static void UseWebSocketConnections(this IApplicationBuilder app, PipelineFactory factory, WebSocketConnectionOptions options) + public static void UseWebSocketConnections(this IApplicationBuilder app, PipeFactory factory, WebSocketConnectionOptions options) { if (factory == null) { diff --git a/src/Microsoft.AspNetCore.WebSockets.Internal/WebSocketConnectionFeature.cs b/src/Microsoft.AspNetCore.WebSockets.Internal/WebSocketConnectionFeature.cs index f713284673..67f91957f7 100644 --- a/src/Microsoft.AspNetCore.WebSockets.Internal/WebSocketConnectionFeature.cs +++ b/src/Microsoft.AspNetCore.WebSockets.Internal/WebSocketConnectionFeature.cs @@ -16,7 +16,7 @@ namespace Microsoft.AspNetCore.WebSockets.Internal private HttpContext _context; private IHttpUpgradeFeature _upgradeFeature; private ILogger _logger; - private readonly PipelineFactory _factory; + private readonly PipeFactory _factory; public bool IsWebSocketRequest { @@ -30,7 +30,7 @@ namespace Microsoft.AspNetCore.WebSockets.Internal } } - public WebSocketConnectionFeature(HttpContext context, PipelineFactory factory, IHttpUpgradeFeature upgradeFeature, ILoggerFactory loggerFactory) + public WebSocketConnectionFeature(HttpContext context, PipeFactory factory, IHttpUpgradeFeature upgradeFeature, ILoggerFactory loggerFactory) { _factory = factory; _context = context; diff --git a/src/Microsoft.AspNetCore.WebSockets.Internal/WebSocketConnectionMiddleware.cs b/src/Microsoft.AspNetCore.WebSockets.Internal/WebSocketConnectionMiddleware.cs index d98a21b65a..197afd16fb 100644 --- a/src/Microsoft.AspNetCore.WebSockets.Internal/WebSocketConnectionMiddleware.cs +++ b/src/Microsoft.AspNetCore.WebSockets.Internal/WebSocketConnectionMiddleware.cs @@ -12,12 +12,12 @@ namespace Microsoft.AspNetCore.WebSockets.Internal { public class WebSocketConnectionMiddleware { - private readonly PipelineFactory _factory; + private readonly PipeFactory _factory; private readonly ILoggerFactory _loggerFactory; private readonly RequestDelegate _next; private readonly WebSocketConnectionOptions _options; - public WebSocketConnectionMiddleware(RequestDelegate next, PipelineFactory factory, WebSocketConnectionOptions options, ILoggerFactory loggerFactory) + public WebSocketConnectionMiddleware(RequestDelegate next, PipeFactory factory, WebSocketConnectionOptions options, ILoggerFactory loggerFactory) { if (next == null) { diff --git a/src/Microsoft.Extensions.WebSockets.Internal/Microsoft.Extensions.WebSockets.Internal.csproj b/src/Microsoft.Extensions.WebSockets.Internal/Microsoft.Extensions.WebSockets.Internal.csproj index 955796e67d..45c314cb42 100644 --- a/src/Microsoft.Extensions.WebSockets.Internal/Microsoft.Extensions.WebSockets.Internal.csproj +++ b/src/Microsoft.Extensions.WebSockets.Internal/Microsoft.Extensions.WebSockets.Internal.csproj @@ -13,8 +13,8 @@ - - + + diff --git a/src/Microsoft.Extensions.WebSockets.Internal/PipelineReaderExtensions.cs b/src/Microsoft.Extensions.WebSockets.Internal/PipeReaderExtensions.cs similarity index 84% rename from src/Microsoft.Extensions.WebSockets.Internal/PipelineReaderExtensions.cs rename to src/Microsoft.Extensions.WebSockets.Internal/PipeReaderExtensions.cs index 2d4204e2fb..758920ab79 100644 --- a/src/Microsoft.Extensions.WebSockets.Internal/PipelineReaderExtensions.cs +++ b/src/Microsoft.Extensions.WebSockets.Internal/PipeReaderExtensions.cs @@ -7,13 +7,13 @@ using System.IO.Pipelines; namespace Microsoft.Extensions.WebSockets.Internal { - public static class PipelineReaderExtensions + public static class PipeReaderExtensions { - public static ValueTask ReadAtLeastAsync(this IPipelineReader input, int minimumRequiredBytes) => ReadAtLeastAsync(input, minimumRequiredBytes, CancellationToken.None); + public static ValueTask ReadAtLeastAsync(this IPipeReader input, int minimumRequiredBytes) => ReadAtLeastAsync(input, minimumRequiredBytes, CancellationToken.None); // TODO: Pull this up to Channels. We should be able to do it there without allocating a Task in any case (rather than here where we can avoid allocation // only if the buffer is already ready and has enough data) - public static ValueTask ReadAtLeastAsync(this IPipelineReader input, int minimumRequiredBytes, CancellationToken cancellationToken) + public static ValueTask ReadAtLeastAsync(this IPipeReader input, int minimumRequiredBytes, CancellationToken cancellationToken) { var awaiter = input.ReadAsync(/* cancellationToken */); @@ -36,7 +36,7 @@ namespace Microsoft.Extensions.WebSockets.Internal return new ValueTask(ReadAtLeastSlowAsync(awaiter, input, minimumRequiredBytes, cancellationToken)); } - private static async Task ReadAtLeastSlowAsync(ReadableBufferAwaitable awaitable, IPipelineReader input, int minimumRequiredBytes, CancellationToken cancellationToken) + private static async Task ReadAtLeastSlowAsync(ReadableBufferAwaitable awaitable, IPipeReader input, int minimumRequiredBytes, CancellationToken cancellationToken) { var result = await awaitable; while (!result.IsCompleted && result.Buffer.Length < minimumRequiredBytes) diff --git a/src/Microsoft.Extensions.WebSockets.Internal/WebSocketConnection.cs b/src/Microsoft.Extensions.WebSockets.Internal/WebSocketConnection.cs index 5530309af6..d6dcca1bf6 100644 --- a/src/Microsoft.Extensions.WebSockets.Internal/WebSocketConnection.cs +++ b/src/Microsoft.Extensions.WebSockets.Internal/WebSocketConnection.cs @@ -29,8 +29,8 @@ namespace Microsoft.Extensions.WebSockets.Internal { private WebSocketOptions _options; private readonly byte[] _maskingKeyBuffer; - private readonly IPipelineReader _inbound; - private readonly IPipelineWriter _outbound; + private readonly IPipeReader _inbound; + private readonly IPipeWriter _outbound; private readonly CancellationTokenSource _terminateReceiveCts = new CancellationTokenSource(); private readonly Timer _pinger; private readonly CancellationTokenSource _timerCts = new CancellationTokenSource(); @@ -45,36 +45,36 @@ namespace Microsoft.Extensions.WebSockets.Internal public WebSocketConnectionState State { get; private set; } = WebSocketConnectionState.Created; /// - /// Constructs a new, unmasked, from an and an that represents an established WebSocket connection (i.e. after handshaking) + /// Constructs a new, unmasked, from an and an that represents an established WebSocket connection (i.e. after handshaking) /// - /// A from which frames will be read when receiving. - /// A to which frame will be written when sending. - public WebSocketConnection(IPipelineReader inbound, IPipelineWriter outbound) : this(inbound, outbound, options: WebSocketOptions.DefaultUnmasked) { } + /// A from which frames will be read when receiving. + /// A to which frame will be written when sending. + public WebSocketConnection(IPipeReader inbound, IPipeWriter outbound) : this(inbound, outbound, options: WebSocketOptions.DefaultUnmasked) { } /// - /// Constructs a new, unmasked, from an and an that represents an established WebSocket connection (i.e. after handshaking) + /// Constructs a new, unmasked, from an and an that represents an established WebSocket connection (i.e. after handshaking) /// - /// A from which frames will be read when receiving. - /// A to which frame will be written when sending. + /// A from which frames will be read when receiving. + /// A to which frame will be written when sending. /// The sub-protocol provided during handshaking - public WebSocketConnection(IPipelineReader inbound, IPipelineWriter outbound, string subProtocol) : this(inbound, outbound, subProtocol, options: WebSocketOptions.DefaultUnmasked) { } + public WebSocketConnection(IPipeReader inbound, IPipeWriter outbound, string subProtocol) : this(inbound, outbound, subProtocol, options: WebSocketOptions.DefaultUnmasked) { } /// - /// Constructs a new, from an and an that represents an established WebSocket connection (i.e. after handshaking) + /// Constructs a new, from an and an that represents an established WebSocket connection (i.e. after handshaking) /// - /// A from which frames will be read when receiving. - /// A to which frame will be written when sending. + /// A from which frames will be read when receiving. + /// A to which frame will be written when sending. /// A which provides the configuration options for the socket. - public WebSocketConnection(IPipelineReader inbound, IPipelineWriter outbound, WebSocketOptions options) : this(inbound, outbound, subProtocol: string.Empty, options: options) { } + public WebSocketConnection(IPipeReader inbound, IPipeWriter outbound, WebSocketOptions options) : this(inbound, outbound, subProtocol: string.Empty, options: options) { } /// - /// Constructs a new from an and an that represents an established WebSocket connection (i.e. after handshaking) + /// Constructs a new from an and an that represents an established WebSocket connection (i.e. after handshaking) /// - /// A from which frames will be read when receiving. - /// A to which frame will be written when sending. + /// A from which frames will be read when receiving. + /// A to which frame will be written when sending. /// The sub-protocol provided during handshaking /// A which provides the configuration options for the socket. - public WebSocketConnection(IPipelineReader inbound, IPipelineWriter outbound, string subProtocol, WebSocketOptions options) + public WebSocketConnection(IPipeReader inbound, IPipeWriter outbound, string subProtocol, WebSocketOptions options) { _inbound = inbound; _outbound = outbound; diff --git a/test/Microsoft.AspNetCore.SignalR.Test.Server/Microsoft.AspNetCore.SignalR.Test.Server.csproj b/test/Microsoft.AspNetCore.SignalR.Test.Server/Microsoft.AspNetCore.SignalR.Test.Server.csproj index 93768cdc63..074d299b24 100644 --- a/test/Microsoft.AspNetCore.SignalR.Test.Server/Microsoft.AspNetCore.SignalR.Test.Server.csproj +++ b/test/Microsoft.AspNetCore.SignalR.Test.Server/Microsoft.AspNetCore.SignalR.Test.Server.csproj @@ -7,7 +7,6 @@ win7-x64 - 1.2.0-* true Exe diff --git a/test/Microsoft.AspNetCore.SignalR.Tests/Microsoft.AspNetCore.SignalR.Tests.csproj b/test/Microsoft.AspNetCore.SignalR.Tests/Microsoft.AspNetCore.SignalR.Tests.csproj index 5b9ec27855..248ab44220 100644 --- a/test/Microsoft.AspNetCore.SignalR.Tests/Microsoft.AspNetCore.SignalR.Tests.csproj +++ b/test/Microsoft.AspNetCore.SignalR.Tests/Microsoft.AspNetCore.SignalR.Tests.csproj @@ -36,7 +36,7 @@ - + diff --git a/test/Microsoft.AspNetCore.Sockets.Tests/WebSocketsTests.cs b/test/Microsoft.AspNetCore.Sockets.Tests/WebSocketsTests.cs index 5706ebe97d..80bcbf285a 100644 --- a/test/Microsoft.AspNetCore.Sockets.Tests/WebSocketsTests.cs +++ b/test/Microsoft.AspNetCore.Sockets.Tests/WebSocketsTests.cs @@ -28,7 +28,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests var transportSide = new ChannelConnection(applicationToTransport, transportToApplication); var applicationSide = new ChannelConnection(transportToApplication, applicationToTransport); - using (var factory = new PipelineFactory()) + using (var factory = new PipeFactory()) using (var pair = WebSocketPair.Create(factory)) { var ws = new WebSocketsTransport(transportSide, new LoggerFactory()); @@ -76,7 +76,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests var transportSide = new ChannelConnection(applicationToTransport, transportToApplication); var applicationSide = new ChannelConnection(transportToApplication, applicationToTransport); - using (var factory = new PipelineFactory()) + using (var factory = new PipeFactory()) using (var pair = WebSocketPair.Create(factory)) { var ws = new WebSocketsTransport(transportSide, new LoggerFactory()); @@ -135,7 +135,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests var transportSide = new ChannelConnection(applicationToTransport, transportToApplication); var applicationSide = new ChannelConnection(transportToApplication, applicationToTransport); - using (var factory = new PipelineFactory()) + using (var factory = new PipeFactory()) using (var pair = WebSocketPair.Create(factory)) { var ws = new WebSocketsTransport(transportSide, new LoggerFactory()); @@ -183,7 +183,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests var transportSide = new ChannelConnection(applicationToTransport, transportToApplication); var applicationSide = new ChannelConnection(transportToApplication, applicationToTransport); - using (var factory = new PipelineFactory()) + using (var factory = new PipeFactory()) using (var pair = WebSocketPair.Create(factory)) { var ws = new WebSocketsTransport(transportSide, new LoggerFactory()); @@ -224,7 +224,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests var transportSide = new ChannelConnection(applicationToTransport, transportToApplication); var applicationSide = new ChannelConnection(transportToApplication, applicationToTransport); - using (var factory = new PipelineFactory()) + using (var factory = new PipeFactory()) using (var pair = WebSocketPair.Create(factory)) { var ws = new WebSocketsTransport(transportSide, new LoggerFactory()); @@ -267,7 +267,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests var transportSide = new ChannelConnection(applicationToTransport, transportToApplication); var applicationSide = new ChannelConnection(transportToApplication, applicationToTransport); - using (var factory = new PipelineFactory()) + using (var factory = new PipeFactory()) using (var pair = WebSocketPair.Create(factory)) { var ws = new WebSocketsTransport(transportSide, new LoggerFactory()); @@ -295,7 +295,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests var transportSide = new ChannelConnection(applicationToTransport, transportToApplication); var applicationSide = new ChannelConnection(transportToApplication, applicationToTransport); - using (var factory = new PipelineFactory()) + using (var factory = new PipeFactory()) using (var pair = WebSocketPair.Create(factory)) { var ws = new WebSocketsTransport(transportSide, new LoggerFactory()); diff --git a/test/Microsoft.AspNetCore.WebSockets.Internal.ConformanceTest/Microsoft.AspNetCore.WebSockets.Internal.ConformanceTest.csproj b/test/Microsoft.AspNetCore.WebSockets.Internal.ConformanceTest/Microsoft.AspNetCore.WebSockets.Internal.ConformanceTest.csproj index dd7dfc79b5..bf811165d1 100644 --- a/test/Microsoft.AspNetCore.WebSockets.Internal.ConformanceTest/Microsoft.AspNetCore.WebSockets.Internal.ConformanceTest.csproj +++ b/test/Microsoft.AspNetCore.WebSockets.Internal.ConformanceTest/Microsoft.AspNetCore.WebSockets.Internal.ConformanceTest.csproj @@ -20,7 +20,7 @@ - + diff --git a/test/Microsoft.Extensions.WebSockets.Internal.Tests/WebSocketConnectionTests.ProtocolErrors.cs b/test/Microsoft.Extensions.WebSockets.Internal.Tests/WebSocketConnectionTests.ProtocolErrors.cs index 0cb6aa1198..18dc4dd42a 100644 --- a/test/Microsoft.Extensions.WebSockets.Internal.Tests/WebSocketConnectionTests.ProtocolErrors.cs +++ b/test/Microsoft.Extensions.WebSockets.Internal.Tests/WebSocketConnectionTests.ProtocolErrors.cs @@ -233,7 +233,7 @@ namespace Microsoft.Extensions.WebSockets.Internal.Tests var server = pair.ServerSocket.ExecuteAndCaptureFramesAsync(); // Act - await pair.ClientToServer.WriteAsync(rawFrame); + await pair.ClientToServer.Writer.WriteAsync(rawFrame); // Server should terminate var clientSummary = await client.OrTimeout(); diff --git a/test/Microsoft.Extensions.WebSockets.Internal.Tests/WebSocketConnectionTests.ReceiveAsync.cs b/test/Microsoft.Extensions.WebSockets.Internal.Tests/WebSocketConnectionTests.ReceiveAsync.cs index 0cb4ee715c..5559d40510 100644 --- a/test/Microsoft.Extensions.WebSockets.Internal.Tests/WebSocketConnectionTests.ReceiveAsync.cs +++ b/test/Microsoft.Extensions.WebSockets.Internal.Tests/WebSocketConnectionTests.ReceiveAsync.cs @@ -1,12 +1,12 @@ // 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 Microsoft.AspNetCore.SignalR.Tests.Common; using System; using System.IO.Pipelines; using System.Text; using System.Threading; using System.Threading.Tasks; +using Microsoft.AspNetCore.SignalR.Tests.Common; using Xunit; namespace Microsoft.Extensions.WebSockets.Internal.Tests @@ -193,9 +193,9 @@ namespace Microsoft.Extensions.WebSockets.Internal.Tests } } - private static async Task RunReceiveTest(Func producer) + private static async Task RunReceiveTest(Func producer) { - using (var factory = new PipelineFactory()) + using (var factory = new PipeFactory()) { var outbound = factory.Create(); var inbound = factory.Create(); @@ -204,13 +204,13 @@ namespace Microsoft.Extensions.WebSockets.Internal.Tests var producerTask = Task.Run(async () => { - await producer(inbound, timeoutToken).OrTimeout(); - inbound.CompleteWriter(); + await producer(inbound.Writer, timeoutToken).OrTimeout(); + inbound.Writer.Complete(); }, timeoutToken); var consumerTask = Task.Run(async () => { - var connection = new WebSocketConnection(inbound, outbound, options: new WebSocketOptions().WithAllFramesPassedThrough()); + var connection = new WebSocketConnection(inbound.Reader, outbound.Writer, options: new WebSocketOptions().WithAllFramesPassedThrough()); using (timeoutToken.Register(() => connection.Dispose())) using (connection) { diff --git a/test/Microsoft.Extensions.WebSockets.Internal.Tests/WebSocketConnectionTests.SendAsync.cs b/test/Microsoft.Extensions.WebSockets.Internal.Tests/WebSocketConnectionTests.SendAsync.cs index c8cdd1cbb0..6513b03520 100644 --- a/test/Microsoft.Extensions.WebSockets.Internal.Tests/WebSocketConnectionTests.SendAsync.cs +++ b/test/Microsoft.Extensions.WebSockets.Internal.Tests/WebSocketConnectionTests.SendAsync.cs @@ -173,13 +173,13 @@ namespace Microsoft.Extensions.WebSockets.Internal.Tests private static async Task RunSendTest(Func producer, WebSocketOptions options) { - using (var factory = new PipelineFactory()) + using (var factory = new PipeFactory()) { var outbound = factory.Create(); var inbound = factory.Create(); Task executeTask; - using (var connection = new WebSocketConnection(inbound, outbound, options)) + using (var connection = new WebSocketConnection(inbound.Reader, outbound.Writer, options)) { executeTask = connection.ExecuteAsync(f => { @@ -187,23 +187,23 @@ namespace Microsoft.Extensions.WebSockets.Internal.Tests return TaskCache.CompletedTask; }); await producer(connection).OrTimeout(); - inbound.CompleteWriter(); + inbound.Writer.Complete(); await executeTask.OrTimeout(); } - var data = (await outbound.ReadToEndAsync()).ToArray(); - inbound.CompleteReader(); + var data = (await outbound.Reader.ReadToEndAsync()).ToArray(); + inbound.Reader.Complete(); CompleteChannels(outbound); return data; } } - private static void CompleteChannels(params Pipe[] readerWriters) + private static void CompleteChannels(params IPipe[] readerWriters) { foreach (var readerWriter in readerWriters) { - readerWriter.CompleteReader(); - readerWriter.CompleteWriter(); + readerWriter.Reader.Complete(); + readerWriter.Writer.Complete(); } } } diff --git a/test/Microsoft.Extensions.WebSockets.Internal.Tests/WebSocketPair.cs b/test/Microsoft.Extensions.WebSockets.Internal.Tests/WebSocketPair.cs index dd137a12a2..eaa78294c1 100644 --- a/test/Microsoft.Extensions.WebSockets.Internal.Tests/WebSocketPair.cs +++ b/test/Microsoft.Extensions.WebSockets.Internal.Tests/WebSocketPair.cs @@ -11,16 +11,16 @@ namespace Microsoft.Extensions.WebSockets.Internal.Tests private static readonly WebSocketOptions DefaultServerOptions = new WebSocketOptions().WithAllFramesPassedThrough().WithRandomMasking(); private static readonly WebSocketOptions DefaultClientOptions = new WebSocketOptions().WithAllFramesPassedThrough(); - private PipelineFactory _factory; + private PipeFactory _factory; private readonly bool _ownFactory; - public Pipe ServerToClient { get; } - public Pipe ClientToServer { get; } + public IPipe ServerToClient { get; } + public IPipe ClientToServer { get; } public IWebSocketConnection ClientSocket { get; } public IWebSocketConnection ServerSocket { get; } - public WebSocketPair(bool ownFactory, PipelineFactory factory, Pipe serverToClient, Pipe clientToServer, IWebSocketConnection clientSocket, IWebSocketConnection serverSocket) + public WebSocketPair(bool ownFactory, PipeFactory factory, IPipe serverToClient, IPipe clientToServer, IWebSocketConnection clientSocket, IWebSocketConnection serverSocket) { _ownFactory = ownFactory; _factory = factory; @@ -30,19 +30,19 @@ namespace Microsoft.Extensions.WebSockets.Internal.Tests ServerSocket = serverSocket; } - public static WebSocketPair Create() => Create(new PipelineFactory(), DefaultServerOptions, DefaultClientOptions, ownFactory: true); - public static WebSocketPair Create(PipelineFactory factory) => Create(factory, DefaultServerOptions, DefaultClientOptions, ownFactory: false); - public static WebSocketPair Create(WebSocketOptions serverOptions, WebSocketOptions clientOptions) => Create(new PipelineFactory(), serverOptions, clientOptions, ownFactory: true); - public static WebSocketPair Create(PipelineFactory factory, WebSocketOptions serverOptions, WebSocketOptions clientOptions) => Create(factory, serverOptions, clientOptions, ownFactory: false); + public static WebSocketPair Create() => Create(new PipeFactory(), DefaultServerOptions, DefaultClientOptions, ownFactory: true); + public static WebSocketPair Create(PipeFactory factory) => Create(factory, DefaultServerOptions, DefaultClientOptions, ownFactory: false); + public static WebSocketPair Create(WebSocketOptions serverOptions, WebSocketOptions clientOptions) => Create(new PipeFactory(), serverOptions, clientOptions, ownFactory: true); + public static WebSocketPair Create(PipeFactory factory, WebSocketOptions serverOptions, WebSocketOptions clientOptions) => Create(factory, serverOptions, clientOptions, ownFactory: false); - private static WebSocketPair Create(PipelineFactory factory, WebSocketOptions serverOptions, WebSocketOptions clientOptions, bool ownFactory) + private static WebSocketPair Create(PipeFactory factory, WebSocketOptions serverOptions, WebSocketOptions clientOptions, bool ownFactory) { // Create channels var serverToClient = factory.Create(); var clientToServer = factory.Create(); - var serverSocket = new WebSocketConnection(clientToServer, serverToClient, options: serverOptions); - var clientSocket = new WebSocketConnection(serverToClient, clientToServer, options: clientOptions); + var serverSocket = new WebSocketConnection(clientToServer.Reader, serverToClient.Writer, options: serverOptions); + var clientSocket = new WebSocketConnection(serverToClient.Reader, clientToServer.Writer, options: clientOptions); return new WebSocketPair(ownFactory, factory, serverToClient, clientToServer, clientSocket, serverSocket); } @@ -60,7 +60,7 @@ namespace Microsoft.Extensions.WebSockets.Internal.Tests public void TerminateFromClient(Exception ex = null) { - ClientToServer.CompleteWriter(ex); + ClientToServer.Writer.Complete(ex); } } } \ No newline at end of file diff --git a/test/WebSocketsTestApp/Startup.cs b/test/WebSocketsTestApp/Startup.cs index 21b812fee8..d990ed1eb3 100644 --- a/test/WebSocketsTestApp/Startup.cs +++ b/test/WebSocketsTestApp/Startup.cs @@ -20,11 +20,11 @@ namespace WebSocketsTestApp // For more information on how to configure your application, visit http://go.microsoft.com/fwlink/?LinkID=398940 public void ConfigureServices(IServiceCollection services) { - services.AddSingleton(); + services.AddSingleton(); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. - public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, PipelineFactory pipelineFactory) + public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, PipeFactory PipeFactory) { loggerFactory.AddConsole(LogLevel.Debug); @@ -33,7 +33,7 @@ namespace WebSocketsTestApp app.UseDeveloperExceptionPage(); } - app.UseWebSocketConnections(pipelineFactory); + app.UseWebSocketConnections(PipeFactory); app.Use(async (context, next) => { diff --git a/test/WebSocketsTestApp/WebSocketsTestApp.csproj b/test/WebSocketsTestApp/WebSocketsTestApp.csproj index 65af174584..a1c3680dc6 100644 --- a/test/WebSocketsTestApp/WebSocketsTestApp.csproj +++ b/test/WebSocketsTestApp/WebSocketsTestApp.csproj @@ -6,7 +6,6 @@ netcoreapp1.1 win7-x64 - 1.2.0-* Exe