Downgrade to stable packages
This commit is contained in:
parent
2a5c4320d2
commit
f684fcb574
|
|
@ -1,4 +1,5 @@
|
|||
<Project>
|
||||
<Import Project="dependencies.props" />
|
||||
<Import Project="..\version.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
|
|
@ -8,8 +9,6 @@
|
|||
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)Key.snk</AssemblyOriginatorKeyFile>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
<PublicSign Condition="'$(OS)' != 'Windows_NT'">true</PublicSign>
|
||||
<NetCoreAppImplicitPackageVersion>1.2.0-*</NetCoreAppImplicitPackageVersion>
|
||||
<NetStandardImplicitPackageVersion>1.6.2-*</NetStandardImplicitPackageVersion>
|
||||
<VersionSuffix Condition="'$(VersionSuffix)'!='' AND '$(BuildNumber)' != ''">$(VersionSuffix)-$(BuildNumber)</VersionSuffix>
|
||||
</PropertyGroup>
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
<Project>
|
||||
<PropertyGroup>
|
||||
<NetStandardImplicitPackageVersion>1.6.1</NetStandardImplicitPackageVersion>
|
||||
<CoreFxVersion>4.3.0</CoreFxVersion>
|
||||
<CoreFxLabsVersion>0.1.0-*</CoreFxLabsVersion>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
|
|
@ -8,7 +8,6 @@
|
|||
<OutputType>Exe</OutputType>
|
||||
<UserSecretsId>aspnet-ChatSample-f11cf018-e0a8-49fa-b749-4c0eb5c9150b</UserSecretsId>
|
||||
<PackageTargetFallback>$(PackageTargetFallback);portable-net45+win8</PackageTargetFallback>
|
||||
<RuntimeFrameworkVersion>1.2.0-*</RuntimeFrameworkVersion>
|
||||
|
||||
<!-- We don't want dotnet pack to try packing a sample -->
|
||||
<IsPackable>false</IsPackable>
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp1.1</TargetFramework>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RuntimeFrameworkVersion>1.2.0-*</RuntimeFrameworkVersion>
|
||||
|
||||
<!-- We don't want dotnet pack to try packing a sample -->
|
||||
<IsPackable>false</IsPackable>
|
||||
|
|
@ -13,7 +12,7 @@
|
|||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\Microsoft.AspNetCore.SignalR.Client\Microsoft.AspNetCore.SignalR.Client.csproj" />
|
||||
<PackageReference Include="System.Net.WebSockets.Client" Version="4.4.0-*" />
|
||||
<PackageReference Include="System.Net.WebSockets.Client" Version="$(CoreFxVersion)" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.2.0-*" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="1.2.0-*" />
|
||||
</ItemGroup>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@
|
|||
<TargetFramework>netcoreapp1.1</TargetFramework>
|
||||
<PreserveCompilationContext>true</PreserveCompilationContext>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RuntimeFrameworkVersion>1.2.0-*</RuntimeFrameworkVersion>
|
||||
|
||||
<!-- We don't want dotnet pack to try packing a sample -->
|
||||
<IsPackable>false</IsPackable>
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@
|
|||
<PreserveCompilationContext>true</PreserveCompilationContext>
|
||||
<OutputType>Exe</OutputType>
|
||||
<PackageTargetFallback Condition=" '$(TargetFramework)' == 'netcoreapp1.1' ">$(PackageTargetFallback);portable-net45+win8+wp8+wpa81</PackageTargetFallback>
|
||||
<RuntimeFrameworkVersion>1.2.0-*</RuntimeFrameworkVersion>
|
||||
|
||||
<!-- We don't want dotnet pack to try packing a sample -->
|
||||
<IsPackable>false</IsPackable>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<Import Project="..\..\build\dependencies.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp1.1</TargetFramework>
|
||||
<OutputType>Exe</OutputType>
|
||||
|
|
@ -9,7 +11,7 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="System.Net.WebSockets.Client" Version="4.3.0-*" />
|
||||
<PackageReference Include="System.Net.WebSockets.Client" Version="$(CoreFxVersion)" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<Import Project="..\..\build\common.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<Description>Client for ASP.NET Core SignalR</Description>
|
||||
<TargetFramework>netstandard1.3</TargetFramework>
|
||||
|
|
@ -7,12 +9,17 @@
|
|||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<PackageTags>aspnetcore;signalr</PackageTags>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Microsoft.AspNetCore.Sockets.Common\Microsoft.AspNetCore.Sockets.Common.csproj" />
|
||||
<PackageReference Include="System.IO.Pipelines" Version="0.1.0-*" />
|
||||
<PackageReference Include="System.Threading.Tasks.Channels" Version="0.1.0-*" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="1.2.0-*" />
|
||||
<PackageReference Include="Microsoft.Extensions.TaskCache.Sources" Version="1.2.0-*" PrivateAssets="All" />
|
||||
<PackageReference Include="System.Net.WebSockets.Client" Version="4.4.0-*" />
|
||||
<PackageReference Include="System.IO.Pipelines" Version="$(CoreFxLabsVersion)" />
|
||||
<PackageReference Include="System.Net.WebSockets.Client" Version="$(CoreFxVersion)" />
|
||||
<PackageReference Include="System.Threading.Tasks.Channels" Version="$(CoreFxLabsVersion)" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
</Project>
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@
|
|||
|
||||
using System;
|
||||
using System.IO.Pipelines;
|
||||
using System.Text;
|
||||
using System.Text.Formatting;
|
||||
|
||||
namespace Microsoft.AspNetCore.Sockets
|
||||
{
|
||||
|
|
|
|||
|
|
@ -11,9 +11,9 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="System.IO.Pipelines" Version="0.1.0-*" />
|
||||
<PackageReference Include="System.Text.Primitives" Version="0.1.0-*" />
|
||||
<PackageReference Include="System.Threading.Tasks.Channels" Version="0.1.0-*" />
|
||||
<PackageReference Include="System.IO.Pipelines" Version="$(CoreFxLabsVersion)" />
|
||||
<PackageReference Include="System.Text.Primitives" Version="$(CoreFxLabsVersion)" />
|
||||
<PackageReference Include="System.Threading.Tasks.Channels" Version="$(CoreFxLabsVersion)" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
|||
|
|
@ -17,9 +17,9 @@
|
|||
<PackageReference Include="Microsoft.AspNetCore.Hosting.Abstractions" Version="1.2.0-*" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Routing" Version="1.2.0-*" />
|
||||
<PackageReference Include="Microsoft.Extensions.TaskCache.Sources" Version="1.2.0-*" PrivateAssets="All"/>
|
||||
<PackageReference Include="System.Reflection.TypeExtensions" Version="4.4.0-*" />
|
||||
<PackageReference Include="System.Security.Claims" Version="4.4.0-*" />
|
||||
<PackageReference Include="System.Threading.Tasks.Channels" Version="0.1.0-*" />
|
||||
<PackageReference Include="System.Reflection.TypeExtensions" Version="$(CoreFxVersion)" />
|
||||
<PackageReference Include="System.Security.Claims" Version="$(CoreFxVersion)" />
|
||||
<PackageReference Include="System.Threading.Tasks.Channels" Version="$(CoreFxLabsVersion)" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="System.IO.Pipelines" Version="0.1.0-*" />
|
||||
<PackageReference Include="System.IO.Pipelines.Text.Primitives" Version="0.1.0-*" />
|
||||
<PackageReference Include="System.IO.Pipelines" Version="$(CoreFxLabsVersion)" />
|
||||
<PackageReference Include="System.IO.Pipelines.Text.Primitives" Version="$(CoreFxLabsVersion)" />
|
||||
<PackageReference Include="Microsoft.Extensions.TaskCache.Sources" Version="1.2.0-*" PrivateAssets="All"/>
|
||||
</ItemGroup>
|
||||
|
||||
|
|
|
|||
|
|
@ -7,13 +7,13 @@ using System.IO.Pipelines;
|
|||
|
||||
namespace Microsoft.Extensions.WebSockets.Internal
|
||||
{
|
||||
public static class PipelineReaderExtensions
|
||||
public static class PipeReaderExtensions
|
||||
{
|
||||
public static ValueTask<ReadResult> ReadAtLeastAsync(this IPipelineReader input, int minimumRequiredBytes) => ReadAtLeastAsync(input, minimumRequiredBytes, CancellationToken.None);
|
||||
public static ValueTask<ReadResult> 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<T> 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<ReadResult> ReadAtLeastAsync(this IPipelineReader input, int minimumRequiredBytes, CancellationToken cancellationToken)
|
||||
public static ValueTask<ReadResult> 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<ReadResult>(ReadAtLeastSlowAsync(awaiter, input, minimumRequiredBytes, cancellationToken));
|
||||
}
|
||||
|
||||
private static async Task<ReadResult> ReadAtLeastSlowAsync(ReadableBufferAwaitable awaitable, IPipelineReader input, int minimumRequiredBytes, CancellationToken cancellationToken)
|
||||
private static async Task<ReadResult> ReadAtLeastSlowAsync(ReadableBufferAwaitable awaitable, IPipeReader input, int minimumRequiredBytes, CancellationToken cancellationToken)
|
||||
{
|
||||
var result = await awaitable;
|
||||
while (!result.IsCompleted && result.Buffer.Length < minimumRequiredBytes)
|
||||
|
|
@ -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;
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a new, unmasked, <see cref="WebSocketConnection"/> from an <see cref="IPipelineReader"/> and an <see cref="IPipelineWriter"/> that represents an established WebSocket connection (i.e. after handshaking)
|
||||
/// Constructs a new, unmasked, <see cref="WebSocketConnection"/> from an <see cref="IPipeReader"/> and an <see cref="IPipeWriter"/> that represents an established WebSocket connection (i.e. after handshaking)
|
||||
/// </summary>
|
||||
/// <param name="inbound">A <see cref="IPipelineReader"/> from which frames will be read when receiving.</param>
|
||||
/// <param name="outbound">A <see cref="IPipelineWriter"/> to which frame will be written when sending.</param>
|
||||
public WebSocketConnection(IPipelineReader inbound, IPipelineWriter outbound) : this(inbound, outbound, options: WebSocketOptions.DefaultUnmasked) { }
|
||||
/// <param name="inbound">A <see cref="IPipeReader"/> from which frames will be read when receiving.</param>
|
||||
/// <param name="outbound">A <see cref="IPipeWriter"/> to which frame will be written when sending.</param>
|
||||
public WebSocketConnection(IPipeReader inbound, IPipeWriter outbound) : this(inbound, outbound, options: WebSocketOptions.DefaultUnmasked) { }
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a new, unmasked, <see cref="WebSocketConnection"/> from an <see cref="IPipelineReader"/> and an <see cref="IPipelineWriter"/> that represents an established WebSocket connection (i.e. after handshaking)
|
||||
/// Constructs a new, unmasked, <see cref="WebSocketConnection"/> from an <see cref="IPipeReader"/> and an <see cref="IPipeWriter"/> that represents an established WebSocket connection (i.e. after handshaking)
|
||||
/// </summary>
|
||||
/// <param name="inbound">A <see cref="IPipelineReader"/> from which frames will be read when receiving.</param>
|
||||
/// <param name="outbound">A <see cref="IPipelineWriter"/> to which frame will be written when sending.</param>
|
||||
/// <param name="inbound">A <see cref="IPipeReader"/> from which frames will be read when receiving.</param>
|
||||
/// <param name="outbound">A <see cref="IPipeWriter"/> to which frame will be written when sending.</param>
|
||||
/// <param name="subProtocol">The sub-protocol provided during handshaking</param>
|
||||
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) { }
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a new, <see cref="WebSocketConnection"/> from an <see cref="IPipelineReader"/> and an <see cref="IPipelineWriter"/> that represents an established WebSocket connection (i.e. after handshaking)
|
||||
/// Constructs a new, <see cref="WebSocketConnection"/> from an <see cref="IPipeReader"/> and an <see cref="IPipeWriter"/> that represents an established WebSocket connection (i.e. after handshaking)
|
||||
/// </summary>
|
||||
/// <param name="inbound">A <see cref="IPipelineReader"/> from which frames will be read when receiving.</param>
|
||||
/// <param name="outbound">A <see cref="IPipelineWriter"/> to which frame will be written when sending.</param>
|
||||
/// <param name="inbound">A <see cref="IPipeReader"/> from which frames will be read when receiving.</param>
|
||||
/// <param name="outbound">A <see cref="IPipeWriter"/> to which frame will be written when sending.</param>
|
||||
/// <param name="options">A <see cref="WebSocketOptions"/> which provides the configuration options for the socket.</param>
|
||||
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) { }
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a new <see cref="WebSocketConnection"/> from an <see cref="IPipelineReader"/> and an <see cref="IPipelineWriter"/> that represents an established WebSocket connection (i.e. after handshaking)
|
||||
/// Constructs a new <see cref="WebSocketConnection"/> from an <see cref="IPipeReader"/> and an <see cref="IPipeWriter"/> that represents an established WebSocket connection (i.e. after handshaking)
|
||||
/// </summary>
|
||||
/// <param name="inbound">A <see cref="IPipelineReader"/> from which frames will be read when receiving.</param>
|
||||
/// <param name="outbound">A <see cref="IPipelineWriter"/> to which frame will be written when sending.</param>
|
||||
/// <param name="inbound">A <see cref="IPipeReader"/> from which frames will be read when receiving.</param>
|
||||
/// <param name="outbound">A <see cref="IPipeWriter"/> to which frame will be written when sending.</param>
|
||||
/// <param name="subProtocol">The sub-protocol provided during handshaking</param>
|
||||
/// <param name="options">A <see cref="WebSocketOptions"/> which provides the configuration options for the socket.</param>
|
||||
public WebSocketConnection(IPipelineReader inbound, IPipelineWriter outbound, string subProtocol, WebSocketOptions options)
|
||||
public WebSocketConnection(IPipeReader inbound, IPipeWriter outbound, string subProtocol, WebSocketOptions options)
|
||||
{
|
||||
_inbound = inbound;
|
||||
_outbound = outbound;
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
<!-- TODO remove when https://github.com/dotnet/sdk/issues/396 is resolved -->
|
||||
<RuntimeIdentifier Condition=" '$(TargetFramework)' != 'netcoreapp1.1' ">win7-x64</RuntimeIdentifier>
|
||||
<RuntimeFrameworkVersion>1.2.0-*</RuntimeFrameworkVersion>
|
||||
<PreserveCompilationContext>true</PreserveCompilationContext>
|
||||
<OutputType>Exe</OutputType>
|
||||
</PropertyGroup>
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp1.1' ">
|
||||
<PackageReference Include="System.Net.WebSockets.Client" Version="4.4.0-*" />
|
||||
<PackageReference Include="System.Net.WebSockets.Client" Version="$(CoreFxVersion)" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
|
|||
var transportSide = new ChannelConnection<Message>(applicationToTransport, transportToApplication);
|
||||
var applicationSide = new ChannelConnection<Message>(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<Message>(applicationToTransport, transportToApplication);
|
||||
var applicationSide = new ChannelConnection<Message>(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<Message>(applicationToTransport, transportToApplication);
|
||||
var applicationSide = new ChannelConnection<Message>(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<Message>(applicationToTransport, transportToApplication);
|
||||
var applicationSide = new ChannelConnection<Message>(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<Message>(applicationToTransport, transportToApplication);
|
||||
var applicationSide = new ChannelConnection<Message>(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<Message>(applicationToTransport, transportToApplication);
|
||||
var applicationSide = new ChannelConnection<Message>(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<Message>(applicationToTransport, transportToApplication);
|
||||
var applicationSide = new ChannelConnection<Message>(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());
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
<PackageReference Include="xunit" Version="2.2.0-*" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp1.1' ">
|
||||
<PackageReference Include="System.Diagnostics.FileVersionInfo" Version="4.4.0-*" />
|
||||
<PackageReference Include="System.Diagnostics.FileVersionInfo" Version="$(CoreFxVersion)" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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<WebSocketConnectionSummary> RunReceiveTest(Func<IPipelineWriter, CancellationToken, Task> producer)
|
||||
private static async Task<WebSocketConnectionSummary> RunReceiveTest(Func<IPipeWriter, CancellationToken, Task> 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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -173,13 +173,13 @@ namespace Microsoft.Extensions.WebSockets.Internal.Tests
|
|||
|
||||
private static async Task<byte[]> RunSendTest(Func<WebSocketConnection, Task> 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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<PipelineFactory>();
|
||||
services.AddSingleton<PipeFactory>();
|
||||
}
|
||||
|
||||
// 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) =>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@
|
|||
<TargetFramework>netcoreapp1.1</TargetFramework>
|
||||
<!-- TODO remove when https://github.com/dotnet/sdk/issues/396 is resolved -->
|
||||
<RuntimeIdentifier Condition=" '$(TargetFramework)' != 'netcoreapp1.1' ">win7-x64</RuntimeIdentifier>
|
||||
<RuntimeFrameworkVersion>1.2.0-*</RuntimeFrameworkVersion>
|
||||
<OutputType>Exe</OutputType>
|
||||
</PropertyGroup>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue