Revert "Use protocol.abstractions primitives instead of socket abstractions (#1429)" (#1431)

This reverts commit e3f197cef0.
This commit is contained in:
David Fowler 2018-02-10 11:30:41 -08:00 committed by GitHub
parent e3f197cef0
commit 3e568588d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 163 additions and 149 deletions

View File

@ -7,52 +7,51 @@
<BuildBundlerMinifierPackageVersion>2.4.337</BuildBundlerMinifierPackageVersion> <BuildBundlerMinifierPackageVersion>2.4.337</BuildBundlerMinifierPackageVersion>
<GoogleProtobufPackageVersion>3.1.0</GoogleProtobufPackageVersion> <GoogleProtobufPackageVersion>3.1.0</GoogleProtobufPackageVersion>
<InternalAspNetCoreSdkPackageVersion>2.1.0-preview2-15698</InternalAspNetCoreSdkPackageVersion> <InternalAspNetCoreSdkPackageVersion>2.1.0-preview2-15698</InternalAspNetCoreSdkPackageVersion>
<MicrosoftAspNetCoreAuthenticationCookiesPackageVersion>2.1.0-preview2-30070</MicrosoftAspNetCoreAuthenticationCookiesPackageVersion> <MicrosoftAspNetCoreAuthenticationCookiesPackageVersion>2.1.0-preview2-30066</MicrosoftAspNetCoreAuthenticationCookiesPackageVersion>
<MicrosoftAspNetCoreAuthenticationCorePackageVersion>2.1.0-preview2-30070</MicrosoftAspNetCoreAuthenticationCorePackageVersion> <MicrosoftAspNetCoreAuthenticationCorePackageVersion>2.1.0-preview2-30066</MicrosoftAspNetCoreAuthenticationCorePackageVersion>
<MicrosoftAspNetCoreAuthenticationJwtBearerPackageVersion>2.1.0-preview2-30070</MicrosoftAspNetCoreAuthenticationJwtBearerPackageVersion> <MicrosoftAspNetCoreAuthenticationJwtBearerPackageVersion>2.1.0-preview2-30066</MicrosoftAspNetCoreAuthenticationJwtBearerPackageVersion>
<MicrosoftAspNetCoreAuthorizationPackageVersion>2.1.0-preview2-30070</MicrosoftAspNetCoreAuthorizationPackageVersion> <MicrosoftAspNetCoreAuthorizationPackageVersion>2.1.0-preview2-30066</MicrosoftAspNetCoreAuthorizationPackageVersion>
<MicrosoftAspNetCoreAuthorizationPolicyPackageVersion>2.1.0-preview2-30070</MicrosoftAspNetCoreAuthorizationPolicyPackageVersion> <MicrosoftAspNetCoreAuthorizationPolicyPackageVersion>2.1.0-preview2-30066</MicrosoftAspNetCoreAuthorizationPolicyPackageVersion>
<MicrosoftAspNetCoreBenchmarkRunnerSourcesPackageVersion>2.1.0-preview2-30070</MicrosoftAspNetCoreBenchmarkRunnerSourcesPackageVersion> <MicrosoftAspNetCoreBenchmarkRunnerSourcesPackageVersion>2.1.0-preview2-30066</MicrosoftAspNetCoreBenchmarkRunnerSourcesPackageVersion>
<MicrosoftAspNetCoreCorsPackageVersion>2.1.0-preview2-30070</MicrosoftAspNetCoreCorsPackageVersion> <MicrosoftAspNetCoreCorsPackageVersion>2.1.0-preview2-30066</MicrosoftAspNetCoreCorsPackageVersion>
<MicrosoftAspNetCoreDiagnosticsEntityFrameworkCorePackageVersion>2.1.0-preview2-30070</MicrosoftAspNetCoreDiagnosticsEntityFrameworkCorePackageVersion> <MicrosoftAspNetCoreDiagnosticsEntityFrameworkCorePackageVersion>2.1.0-preview2-30066</MicrosoftAspNetCoreDiagnosticsEntityFrameworkCorePackageVersion>
<MicrosoftAspNetCoreDiagnosticsPackageVersion>2.1.0-preview2-30070</MicrosoftAspNetCoreDiagnosticsPackageVersion> <MicrosoftAspNetCoreDiagnosticsPackageVersion>2.1.0-preview2-30066</MicrosoftAspNetCoreDiagnosticsPackageVersion>
<MicrosoftAspNetCoreHostingAbstractionsPackageVersion>2.1.0-preview2-30070</MicrosoftAspNetCoreHostingAbstractionsPackageVersion> <MicrosoftAspNetCoreHostingAbstractionsPackageVersion>2.1.0-preview2-30066</MicrosoftAspNetCoreHostingAbstractionsPackageVersion>
<MicrosoftAspNetCoreHostingPackageVersion>2.1.0-preview2-30070</MicrosoftAspNetCoreHostingPackageVersion> <MicrosoftAspNetCoreHostingPackageVersion>2.1.0-preview2-30066</MicrosoftAspNetCoreHostingPackageVersion>
<MicrosoftAspNetCoreHttpAbstractionsPackageVersion>2.1.0-preview2-30070</MicrosoftAspNetCoreHttpAbstractionsPackageVersion> <MicrosoftAspNetCoreHttpAbstractionsPackageVersion>2.1.0-preview2-30066</MicrosoftAspNetCoreHttpAbstractionsPackageVersion>
<MicrosoftAspNetCoreHttpFeaturesPackageVersion>2.1.0-preview2-30070</MicrosoftAspNetCoreHttpFeaturesPackageVersion> <MicrosoftAspNetCoreHttpFeaturesPackageVersion>2.1.0-preview2-30066</MicrosoftAspNetCoreHttpFeaturesPackageVersion>
<MicrosoftAspNetCoreHttpPackageVersion>2.1.0-preview2-30070</MicrosoftAspNetCoreHttpPackageVersion> <MicrosoftAspNetCoreHttpPackageVersion>2.1.0-preview2-30066</MicrosoftAspNetCoreHttpPackageVersion>
<MicrosoftAspNetCoreIdentityEntityFrameworkCorePackageVersion>2.1.0-preview2-30070</MicrosoftAspNetCoreIdentityEntityFrameworkCorePackageVersion> <MicrosoftAspNetCoreIdentityEntityFrameworkCorePackageVersion>2.1.0-preview2-30066</MicrosoftAspNetCoreIdentityEntityFrameworkCorePackageVersion>
<MicrosoftAspNetCoreMvcPackageVersion>2.1.0-preview2-30070</MicrosoftAspNetCoreMvcPackageVersion> <MicrosoftAspNetCoreMvcPackageVersion>2.1.0-preview2-30066</MicrosoftAspNetCoreMvcPackageVersion>
<MicrosoftAspNetCoreProtocolsAbstractionsPackageVersion>2.1.0-preview2-30070</MicrosoftAspNetCoreProtocolsAbstractionsPackageVersion> <MicrosoftAspNetCoreRoutingPackageVersion>2.1.0-preview2-30066</MicrosoftAspNetCoreRoutingPackageVersion>
<MicrosoftAspNetCoreRoutingPackageVersion>2.1.0-preview2-30070</MicrosoftAspNetCoreRoutingPackageVersion> <MicrosoftAspNetCoreServerIISIntegrationPackageVersion>2.1.0-preview2-30066</MicrosoftAspNetCoreServerIISIntegrationPackageVersion>
<MicrosoftAspNetCoreServerIISIntegrationPackageVersion>2.1.0-preview2-30070</MicrosoftAspNetCoreServerIISIntegrationPackageVersion> <MicrosoftAspNetCoreServerIntegrationTestingPackageVersion>0.5.0-preview2-30066</MicrosoftAspNetCoreServerIntegrationTestingPackageVersion>
<MicrosoftAspNetCoreServerIntegrationTestingPackageVersion>0.5.0-preview2-30070</MicrosoftAspNetCoreServerIntegrationTestingPackageVersion> <MicrosoftAspNetCoreServerKestrelPackageVersion>2.1.0-preview2-30066</MicrosoftAspNetCoreServerKestrelPackageVersion>
<MicrosoftAspNetCoreServerKestrelPackageVersion>2.1.0-preview2-30070</MicrosoftAspNetCoreServerKestrelPackageVersion> <MicrosoftAspNetCoreStaticFilesPackageVersion>2.1.0-preview2-30066</MicrosoftAspNetCoreStaticFilesPackageVersion>
<MicrosoftAspNetCoreStaticFilesPackageVersion>2.1.0-preview2-30070</MicrosoftAspNetCoreStaticFilesPackageVersion> <MicrosoftAspNetCoreTestHostPackageVersion>2.1.0-preview2-30066</MicrosoftAspNetCoreTestHostPackageVersion>
<MicrosoftAspNetCoreTestHostPackageVersion>2.1.0-preview2-30070</MicrosoftAspNetCoreTestHostPackageVersion> <MicrosoftAspNetCoreTestingPackageVersion>2.1.0-preview2-30066</MicrosoftAspNetCoreTestingPackageVersion>
<MicrosoftAspNetCoreTestingPackageVersion>2.1.0-preview2-30070</MicrosoftAspNetCoreTestingPackageVersion> <MicrosoftAspNetCoreWebSocketsPackageVersion>2.1.0-preview2-30066</MicrosoftAspNetCoreWebSocketsPackageVersion>
<MicrosoftAspNetCoreWebSocketsPackageVersion>2.1.0-preview2-30070</MicrosoftAspNetCoreWebSocketsPackageVersion>
<MicrosoftCSharpPackageVersion>4.5.0-preview2-26130-01</MicrosoftCSharpPackageVersion> <MicrosoftCSharpPackageVersion>4.5.0-preview2-26130-01</MicrosoftCSharpPackageVersion>
<MicrosoftEntityFrameworkCoreDesignPackageVersion>2.1.0-preview2-30070</MicrosoftEntityFrameworkCoreDesignPackageVersion> <MicrosoftEntityFrameworkCoreDesignPackageVersion>2.1.0-preview2-30066</MicrosoftEntityFrameworkCoreDesignPackageVersion>
<MicrosoftEntityFrameworkCoreSqlServerPackageVersion>2.1.0-preview2-30070</MicrosoftEntityFrameworkCoreSqlServerPackageVersion> <MicrosoftEntityFrameworkCoreSqlServerPackageVersion>2.1.0-preview2-30066</MicrosoftEntityFrameworkCoreSqlServerPackageVersion>
<MicrosoftEntityFrameworkCoreToolsPackageVersion>2.1.0-preview2-30070</MicrosoftEntityFrameworkCoreToolsPackageVersion> <MicrosoftEntityFrameworkCoreToolsPackageVersion>2.1.0-preview2-30066</MicrosoftEntityFrameworkCoreToolsPackageVersion>
<MicrosoftExtensionsClosedGenericMatcherSourcesPackageVersion>2.1.0-preview2-30070</MicrosoftExtensionsClosedGenericMatcherSourcesPackageVersion> <MicrosoftExtensionsClosedGenericMatcherSourcesPackageVersion>2.1.0-preview2-30066</MicrosoftExtensionsClosedGenericMatcherSourcesPackageVersion>
<MicrosoftExtensionsCommandLineUtilsSourcesPackageVersion>2.1.0-preview2-30070</MicrosoftExtensionsCommandLineUtilsSourcesPackageVersion> <MicrosoftExtensionsCommandLineUtilsSourcesPackageVersion>2.1.0-preview2-30066</MicrosoftExtensionsCommandLineUtilsSourcesPackageVersion>
<MicrosoftExtensionsConfigurationCommandLinePackageVersion>2.1.0-preview2-30070</MicrosoftExtensionsConfigurationCommandLinePackageVersion> <MicrosoftExtensionsConfigurationCommandLinePackageVersion>2.1.0-preview2-30066</MicrosoftExtensionsConfigurationCommandLinePackageVersion>
<MicrosoftExtensionsConfigurationEnvironmentVariablesPackageVersion>2.1.0-preview2-30070</MicrosoftExtensionsConfigurationEnvironmentVariablesPackageVersion> <MicrosoftExtensionsConfigurationEnvironmentVariablesPackageVersion>2.1.0-preview2-30066</MicrosoftExtensionsConfigurationEnvironmentVariablesPackageVersion>
<MicrosoftExtensionsConfigurationUserSecretsPackageVersion>2.1.0-preview2-30070</MicrosoftExtensionsConfigurationUserSecretsPackageVersion> <MicrosoftExtensionsConfigurationUserSecretsPackageVersion>2.1.0-preview2-30066</MicrosoftExtensionsConfigurationUserSecretsPackageVersion>
<MicrosoftExtensionsDependencyInjectionAbstractionsPackageVersion>2.1.0-preview2-30070</MicrosoftExtensionsDependencyInjectionAbstractionsPackageVersion> <MicrosoftExtensionsDependencyInjectionAbstractionsPackageVersion>2.1.0-preview2-30066</MicrosoftExtensionsDependencyInjectionAbstractionsPackageVersion>
<MicrosoftExtensionsDependencyInjectionPackageVersion>2.1.0-preview2-30070</MicrosoftExtensionsDependencyInjectionPackageVersion> <MicrosoftExtensionsDependencyInjectionPackageVersion>2.1.0-preview2-30066</MicrosoftExtensionsDependencyInjectionPackageVersion>
<MicrosoftExtensionsLoggingAbstractionsPackageVersion>2.1.0-preview2-30070</MicrosoftExtensionsLoggingAbstractionsPackageVersion> <MicrosoftExtensionsLoggingAbstractionsPackageVersion>2.1.0-preview2-30066</MicrosoftExtensionsLoggingAbstractionsPackageVersion>
<MicrosoftExtensionsLoggingConfigurationPackageVersion>2.1.0-preview2-30070</MicrosoftExtensionsLoggingConfigurationPackageVersion> <MicrosoftExtensionsLoggingConfigurationPackageVersion>2.1.0-preview2-30066</MicrosoftExtensionsLoggingConfigurationPackageVersion>
<MicrosoftExtensionsLoggingConsolePackageVersion>2.1.0-preview2-30070</MicrosoftExtensionsLoggingConsolePackageVersion> <MicrosoftExtensionsLoggingConsolePackageVersion>2.1.0-preview2-30066</MicrosoftExtensionsLoggingConsolePackageVersion>
<MicrosoftExtensionsLoggingDebugPackageVersion>2.1.0-preview2-30070</MicrosoftExtensionsLoggingDebugPackageVersion> <MicrosoftExtensionsLoggingDebugPackageVersion>2.1.0-preview2-30066</MicrosoftExtensionsLoggingDebugPackageVersion>
<MicrosoftExtensionsLoggingPackageVersion>2.1.0-preview2-30070</MicrosoftExtensionsLoggingPackageVersion> <MicrosoftExtensionsLoggingPackageVersion>2.1.0-preview2-30066</MicrosoftExtensionsLoggingPackageVersion>
<MicrosoftExtensionsLoggingTestingPackageVersion>2.1.0-preview2-30070</MicrosoftExtensionsLoggingTestingPackageVersion> <MicrosoftExtensionsLoggingTestingPackageVersion>2.1.0-preview2-30066</MicrosoftExtensionsLoggingTestingPackageVersion>
<MicrosoftExtensionsObjectMethodExecutorSourcesPackageVersion>2.1.0-preview2-30070</MicrosoftExtensionsObjectMethodExecutorSourcesPackageVersion> <MicrosoftExtensionsObjectMethodExecutorSourcesPackageVersion>2.1.0-preview2-30066</MicrosoftExtensionsObjectMethodExecutorSourcesPackageVersion>
<MicrosoftExtensionsOptionsPackageVersion>2.1.0-preview2-30070</MicrosoftExtensionsOptionsPackageVersion> <MicrosoftExtensionsOptionsPackageVersion>2.1.0-preview2-30066</MicrosoftExtensionsOptionsPackageVersion>
<MicrosoftExtensionsSecurityHelperSourcesPackageVersion>2.1.0-preview2-30070</MicrosoftExtensionsSecurityHelperSourcesPackageVersion> <MicrosoftExtensionsSecurityHelperSourcesPackageVersion>2.1.0-preview2-30066</MicrosoftExtensionsSecurityHelperSourcesPackageVersion>
<MicrosoftExtensionsValueStopwatchSourcesPackageVersion>2.1.0-preview2-30070</MicrosoftExtensionsValueStopwatchSourcesPackageVersion> <MicrosoftExtensionsValueStopwatchSourcesPackageVersion>2.1.0-preview2-30066</MicrosoftExtensionsValueStopwatchSourcesPackageVersion>
<MicrosoftNETCoreApp20PackageVersion>2.0.0</MicrosoftNETCoreApp20PackageVersion> <MicrosoftNETCoreApp20PackageVersion>2.0.0</MicrosoftNETCoreApp20PackageVersion>
<MicrosoftNETCoreApp21PackageVersion>2.1.0-preview2-26130-04</MicrosoftNETCoreApp21PackageVersion> <MicrosoftNETCoreApp21PackageVersion>2.1.0-preview2-26130-04</MicrosoftNETCoreApp21PackageVersion>
<MicrosoftNETTestSdkPackageVersion>15.3.0</MicrosoftNETTestSdkPackageVersion> <MicrosoftNETTestSdkPackageVersion>15.3.0</MicrosoftNETTestSdkPackageVersion>
@ -71,7 +70,7 @@
<SystemThreadingChannelsPackageVersion>4.5.0-preview2-26130-01</SystemThreadingChannelsPackageVersion> <SystemThreadingChannelsPackageVersion>4.5.0-preview2-26130-01</SystemThreadingChannelsPackageVersion>
<SystemThreadingTasksExtensionsPackageVersion>4.5.0-preview2-26130-01</SystemThreadingTasksExtensionsPackageVersion> <SystemThreadingTasksExtensionsPackageVersion>4.5.0-preview2-26130-01</SystemThreadingTasksExtensionsPackageVersion>
<XunitPackageVersion>2.3.1</XunitPackageVersion> <XunitPackageVersion>2.3.1</XunitPackageVersion>
<XunitRunnerVisualStudioPackageVersion>2.4.0-beta.1.build3945</XunitRunnerVisualStudioPackageVersion> <XunitRunnerVisualStudioPackageVersion>2.3.1</XunitRunnerVisualStudioPackageVersion>
</PropertyGroup> </PropertyGroup>
<Import Project="$(DotNetPackageVersionPropsPath)" Condition=" '$(DotNetPackageVersionPropsPath)' != '' " /> <Import Project="$(DotNetPackageVersionPropsPath)" Condition=" '$(DotNetPackageVersionPropsPath)' != '' " />
</Project> </Project>

View File

@ -3,7 +3,6 @@
using System.IO.Pipelines; using System.IO.Pipelines;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Protocols;
using Microsoft.AspNetCore.Sockets; using Microsoft.AspNetCore.Sockets;
namespace FunctionalTests namespace FunctionalTests

View File

@ -6,7 +6,6 @@ using System.Collections.Generic;
using System.IO; using System.IO;
using System.IO.Pipelines; using System.IO.Pipelines;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Protocols;
using Microsoft.AspNetCore.Sockets; using Microsoft.AspNetCore.Sockets;
using Microsoft.AspNetCore.Sockets.Features; using Microsoft.AspNetCore.Sockets.Features;
@ -24,9 +23,9 @@ namespace SocialWeather
public void OnConnectedAsync(ConnectionContext connection) public void OnConnectedAsync(ConnectionContext connection)
{ {
connection.Features.Get<IConnectionMetadataFeature>().Metadata["groups"] = new HashSet<string>(); connection.Metadata["groups"] = new HashSet<string>();
var format = connection.GetHttpContext().Request.Query["formatType"].ToString(); var format = connection.GetHttpContext().Request.Query["formatType"].ToString();
connection.Features.Get<IConnectionMetadataFeature>().Metadata["format"] = format; connection.Metadata["format"] = format;
if (string.Equals(format, "protobuf", StringComparison.OrdinalIgnoreCase)) if (string.Equals(format, "protobuf", StringComparison.OrdinalIgnoreCase))
{ {
var transferModeFeature = connection.Features.Get<ITransferModeFeature>(); var transferModeFeature = connection.Features.Get<ITransferModeFeature>();
@ -48,7 +47,7 @@ namespace SocialWeather
foreach (var connection in _connectionList) foreach (var connection in _connectionList)
{ {
var context = connection.GetHttpContext(); var context = connection.GetHttpContext();
var formatter = _formatterResolver.GetFormatter<T>((string)connection.Features.Get<IConnectionMetadataFeature>().Metadata["format"]); var formatter = _formatterResolver.GetFormatter<T>((string)connection.Metadata["format"]);
var ms = new MemoryStream(); var ms = new MemoryStream();
await formatter.WriteAsync(data, ms); await formatter.WriteAsync(data, ms);
@ -73,7 +72,7 @@ namespace SocialWeather
public void AddGroupAsync(ConnectionContext connection, string groupName) public void AddGroupAsync(ConnectionContext connection, string groupName)
{ {
var groups = (HashSet<string>)connection.Features.Get<IConnectionMetadataFeature>().Metadata["groups"]; var groups = (HashSet<string>)connection.Metadata["groups"];
lock (groups) lock (groups)
{ {
groups.Add(groupName); groups.Add(groupName);
@ -82,7 +81,7 @@ namespace SocialWeather
public void RemoveGroupAsync(ConnectionContext connection, string groupName) public void RemoveGroupAsync(ConnectionContext connection, string groupName)
{ {
var groups = (HashSet<string>)connection.Features.Get<IConnectionMetadataFeature>().Metadata["groups"]; var groups = (HashSet<string>)connection.Metadata["groups"];
if (groups != null) if (groups != null)
{ {
lock (groups) lock (groups)

View File

@ -3,9 +3,7 @@
using System.IO; using System.IO;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Protocols;
using Microsoft.AspNetCore.Sockets; using Microsoft.AspNetCore.Sockets;
using Microsoft.AspNetCore.Sockets.Features;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
namespace SocialWeather namespace SocialWeather
@ -34,7 +32,7 @@ namespace SocialWeather
public async Task ProcessRequests(ConnectionContext connection) public async Task ProcessRequests(ConnectionContext connection)
{ {
var formatter = _formatterResolver.GetFormatter<WeatherReport>( var formatter = _formatterResolver.GetFormatter<WeatherReport>(
(string)connection.Features.Get<IConnectionMetadataFeature>().Metadata["format"]); (string)connection.Metadata["format"]);
while (true) while (true)
{ {

View File

@ -5,9 +5,7 @@ using System.Collections.Generic;
using System.IO.Pipelines; using System.IO.Pipelines;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Protocols;
using Microsoft.AspNetCore.Sockets; using Microsoft.AspNetCore.Sockets;
using Microsoft.AspNetCore.Sockets.Features;
namespace SocketsSample.EndPoints namespace SocketsSample.EndPoints
{ {
@ -19,7 +17,7 @@ namespace SocketsSample.EndPoints
{ {
Connections.Add(connection); Connections.Add(connection);
await Broadcast($"{connection.ConnectionId} connected ({connection.Features.Get<IConnectionMetadataFeature>().Metadata[ConnectionMetadataNames.Transport]})"); await Broadcast($"{connection.ConnectionId} connected ({connection.Metadata[ConnectionMetadataNames.Transport]})");
try try
{ {
@ -52,7 +50,7 @@ namespace SocketsSample.EndPoints
{ {
Connections.Remove(connection); Connections.Remove(connection);
await Broadcast($"{connection.ConnectionId} disconnected ({connection.Features.Get<IConnectionMetadataFeature>().Metadata[ConnectionMetadataNames.Transport]})"); await Broadcast($"{connection.ConnectionId} disconnected ({connection.Metadata[ConnectionMetadataNames.Transport]})");
} }
} }

View File

@ -3,10 +3,8 @@
using System.IO; using System.IO;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.SignalR;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using SocketsSample.Hubs;
namespace SocketsSample namespace SocketsSample
{ {
@ -25,18 +23,7 @@ namespace SocketsSample
{ {
factory.AddConsole(); factory.AddConsole();
}) })
.UseKestrel(options => .UseKestrel()
{
// Default port
options.ListenLocalhost(5000);
// Hub bound to TCP end point
options.ListenLocalhost(9001, builder =>
{
// Run the hub on this port (this won't work properly until streaming parsing is implemented)
builder.UseHub<Chat>();
});
})
.UseContentRoot(Directory.GetCurrentDirectory()) .UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration() .UseIISIntegration()
.UseStartup<Startup>() .UseStartup<Startup>()

View File

@ -13,7 +13,6 @@ using System.Threading;
using System.Threading.Channels; using System.Threading.Channels;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Http.Features; using Microsoft.AspNetCore.Http.Features;
using Microsoft.AspNetCore.Protocols;
using Microsoft.AspNetCore.SignalR.Core; using Microsoft.AspNetCore.SignalR.Core;
using Microsoft.AspNetCore.SignalR.Internal; using Microsoft.AspNetCore.SignalR.Internal;
using Microsoft.AspNetCore.SignalR.Internal.Encoders; using Microsoft.AspNetCore.SignalR.Internal.Encoders;
@ -65,7 +64,7 @@ namespace Microsoft.AspNetCore.SignalR
public virtual IFeatureCollection Features => _connectionContext.Features; public virtual IFeatureCollection Features => _connectionContext.Features;
public virtual IDictionary<object, object> Metadata => Features.Get<IConnectionMetadataFeature>().Metadata; public virtual IDictionary<object, object> Metadata => _connectionContext.Metadata;
public virtual PipeReader Input => _connectionContext.Transport.Input; public virtual PipeReader Input => _connectionContext.Transport.Input;

View File

@ -11,10 +11,10 @@ using System.Threading;
using System.Threading.Channels; using System.Threading.Channels;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Protocols;
using Microsoft.AspNetCore.SignalR.Core; using Microsoft.AspNetCore.SignalR.Core;
using Microsoft.AspNetCore.SignalR.Internal; using Microsoft.AspNetCore.SignalR.Internal;
using Microsoft.AspNetCore.SignalR.Internal.Protocol; using Microsoft.AspNetCore.SignalR.Internal.Protocol;
using Microsoft.AspNetCore.Sockets;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Internal; using Microsoft.Extensions.Internal;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;

View File

@ -1,7 +1,6 @@
// Copyright (c) .NET Foundation. All rights reserved. // 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. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.AspNetCore.Protocols;
using Microsoft.AspNetCore.Sockets; using Microsoft.AspNetCore.Sockets;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
@ -9,7 +8,7 @@ namespace Microsoft.AspNetCore.SignalR
{ {
public static class SignalRSocketBuilderExtensions public static class SignalRSocketBuilderExtensions
{ {
public static IConnectionBuilder UseHub<THub>(this IConnectionBuilder socketBuilder) where THub : Hub public static ISocketBuilder UseHub<THub>(this ISocketBuilder socketBuilder) where THub : Hub
{ {
var endpoint = socketBuilder.ApplicationServices.GetRequiredService<HubEndPoint<THub>>(); var endpoint = socketBuilder.ApplicationServices.GetRequiredService<HubEndPoint<THub>>();
return socketBuilder.Run(connection => endpoint.OnConnectedAsync(connection)); return socketBuilder.Run(connection => endpoint.OnConnectedAsync(connection));

View File

@ -0,0 +1,20 @@
// 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.Collections.Generic;
using System.IO.Pipelines;
using Microsoft.AspNetCore.Http.Features;
namespace Microsoft.AspNetCore.Sockets
{
public abstract class ConnectionContext
{
public abstract string ConnectionId { get; set; }
public abstract IFeatureCollection Features { get; }
public abstract IDictionary<object, object> Metadata { get; set; }
public abstract IDuplexPipe Transport { get; set; }
}
}

View File

@ -0,0 +1,18 @@
// 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;
using System.Collections.Generic;
using System.Text;
namespace Microsoft.AspNetCore.Sockets
{
public interface ISocketBuilder
{
IServiceProvider ApplicationServices { get; }
ISocketBuilder Use(Func<SocketDelegate, SocketDelegate> middleware);
SocketDelegate Build();
}
}

View File

@ -8,7 +8,6 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Http.Features" Version="$(MicrosoftAspNetCoreHttpFeaturesPackageVersion)" /> <PackageReference Include="Microsoft.AspNetCore.Http.Features" Version="$(MicrosoftAspNetCoreHttpFeaturesPackageVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Protocols.Abstractions" Version="$(MicrosoftAspNetCoreProtocolsAbstractionsPackageVersion)" />
<PackageReference Include="System.Threading.Channels" Version="$(SystemThreadingChannelsPackageVersion)" /> <PackageReference Include="System.Threading.Channels" Version="$(SystemThreadingChannelsPackageVersion)" />
<PackageReference Include="System.IO.Pipelines" Version="$(SystemIOPipelinesPackageVersion)" /> <PackageReference Include="System.IO.Pipelines" Version="$(SystemIOPipelinesPackageVersion)" />
<PackageReference Include="System.Memory" Version="$(SystemMemoryPackageVersion)" /> <PackageReference Include="System.Memory" Version="$(SystemMemoryPackageVersion)" />

View File

@ -6,30 +6,29 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Protocols;
namespace Microsoft.AspNetCore.Sockets namespace Microsoft.AspNetCore.Sockets
{ {
public class ConnectionBuilder : IConnectionBuilder public class SocketBuilder : ISocketBuilder
{ {
private readonly IList<Func<ConnectionDelegate, ConnectionDelegate>> _components = new List<Func<ConnectionDelegate, ConnectionDelegate>>(); private readonly IList<Func<SocketDelegate, SocketDelegate>> _components = new List<Func<SocketDelegate, SocketDelegate>>();
public IServiceProvider ApplicationServices { get; } public IServiceProvider ApplicationServices { get; }
public ConnectionBuilder(IServiceProvider applicationServices) public SocketBuilder(IServiceProvider applicationServices)
{ {
ApplicationServices = applicationServices; ApplicationServices = applicationServices;
} }
public IConnectionBuilder Use(Func<ConnectionDelegate, ConnectionDelegate> middleware) public ISocketBuilder Use(Func<SocketDelegate, SocketDelegate> middleware)
{ {
_components.Add(middleware); _components.Add(middleware);
return this; return this;
} }
public ConnectionDelegate Build() public SocketDelegate Build()
{ {
ConnectionDelegate app = features => SocketDelegate app = features =>
{ {
return Task.CompletedTask; return Task.CompletedTask;
}; };

View File

@ -3,13 +3,12 @@
using System; using System;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Protocols;
namespace Microsoft.AspNetCore.Sockets namespace Microsoft.AspNetCore.Sockets
{ {
public static class SocketBuilderExtensions public static class SocketBuilderExtensions
{ {
public static IConnectionBuilder Use(this IConnectionBuilder socketBuilder, Func<ConnectionContext, Func<Task>, Task> middleware) public static ISocketBuilder Use(this ISocketBuilder socketBuilder, Func<ConnectionContext, Func<Task>, Task> middleware)
{ {
return socketBuilder.Use(next => return socketBuilder.Use(next =>
{ {
@ -21,7 +20,7 @@ namespace Microsoft.AspNetCore.Sockets
}); });
} }
public static IConnectionBuilder Run(this IConnectionBuilder socketBuilder, Func<ConnectionContext, Task> middleware) public static ISocketBuilder Run(this ISocketBuilder socketBuilder, Func<ConnectionContext, Task> middleware)
{ {
return socketBuilder.Use(next => return socketBuilder.Use(next =>
{ {

View File

@ -0,0 +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 System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
namespace Microsoft.AspNetCore.Sockets
{
public delegate Task SocketDelegate(ConnectionContext connection);
}

View File

@ -1,8 +1,10 @@
// Copyright (c) .NET Foundation. All rights reserved. // 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. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Protocols;
using Microsoft.AspNetCore.Sockets.Http.Features; using Microsoft.AspNetCore.Sockets.Http.Features;
namespace Microsoft.AspNetCore.Sockets namespace Microsoft.AspNetCore.Sockets

View File

@ -10,7 +10,6 @@ using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Features; using Microsoft.AspNetCore.Http.Features;
using Microsoft.AspNetCore.Protocols;
using Microsoft.AspNetCore.Sockets.Features; using Microsoft.AspNetCore.Sockets.Features;
using Microsoft.AspNetCore.Sockets.Internal; using Microsoft.AspNetCore.Sockets.Internal;
using Microsoft.AspNetCore.Sockets.Internal.Transports; using Microsoft.AspNetCore.Sockets.Internal.Transports;
@ -33,7 +32,7 @@ namespace Microsoft.AspNetCore.Sockets
_logger = _loggerFactory.CreateLogger<HttpConnectionDispatcher>(); _logger = _loggerFactory.CreateLogger<HttpConnectionDispatcher>();
} }
public async Task ExecuteAsync(HttpContext context, HttpSocketOptions options, ConnectionDelegate ConnectionDelegate) public async Task ExecuteAsync(HttpContext context, HttpSocketOptions options, SocketDelegate socketDelegate)
{ {
// Create the log scope and attempt to pass the Connection ID to it so as many logs as possible contain // Create the log scope and attempt to pass the Connection ID to it so as many logs as possible contain
// the Connection ID metadata. If this is the negotiate request then the Connection ID for the scope will // the Connection ID metadata. If this is the negotiate request then the Connection ID for the scope will
@ -54,7 +53,7 @@ namespace Microsoft.AspNetCore.Sockets
else if (HttpMethods.IsGet(context.Request.Method)) else if (HttpMethods.IsGet(context.Request.Method))
{ {
// GET /{path} // GET /{path}
await ExecuteEndpointAsync(context, ConnectionDelegate, options, logScope); await ExecuteEndpointAsync(context, socketDelegate, options, logScope);
} }
else else
{ {
@ -88,7 +87,7 @@ namespace Microsoft.AspNetCore.Sockets
} }
} }
private async Task ExecuteEndpointAsync(HttpContext context, ConnectionDelegate ConnectionDelegate, HttpSocketOptions options, ConnectionLogScope logScope) private async Task ExecuteEndpointAsync(HttpContext context, SocketDelegate socketDelegate, HttpSocketOptions options, ConnectionLogScope logScope)
{ {
var supportedTransports = options.Transports; var supportedTransports = options.Transports;
@ -120,7 +119,7 @@ namespace Microsoft.AspNetCore.Sockets
// We only need to provide the Input channel since writing to the application is handled through /send. // We only need to provide the Input channel since writing to the application is handled through /send.
var sse = new ServerSentEventsTransport(connection.Application.Input, connection.ConnectionId, _loggerFactory); var sse = new ServerSentEventsTransport(connection.Application.Input, connection.ConnectionId, _loggerFactory);
await DoPersistentConnection(ConnectionDelegate, sse, context, connection); await DoPersistentConnection(socketDelegate, sse, context, connection);
} }
else if (context.WebSockets.IsWebSocketRequest) else if (context.WebSockets.IsWebSocketRequest)
{ {
@ -142,7 +141,7 @@ namespace Microsoft.AspNetCore.Sockets
var ws = new WebSocketsTransport(options.WebSockets, connection.Application, connection, _loggerFactory); var ws = new WebSocketsTransport(options.WebSockets, connection.Application, connection, _loggerFactory);
await DoPersistentConnection(ConnectionDelegate, ws, context, connection); await DoPersistentConnection(socketDelegate, ws, context, connection);
} }
else else
{ {
@ -203,7 +202,7 @@ namespace Microsoft.AspNetCore.Sockets
connection.Metadata[ConnectionMetadataNames.Transport] = TransportType.LongPolling; connection.Metadata[ConnectionMetadataNames.Transport] = TransportType.LongPolling;
connection.ApplicationTask = ExecuteApplication(ConnectionDelegate, connection); connection.ApplicationTask = ExecuteApplication(socketDelegate, connection);
} }
else else
{ {
@ -292,7 +291,7 @@ namespace Microsoft.AspNetCore.Sockets
} }
} }
private async Task DoPersistentConnection(ConnectionDelegate ConnectionDelegate, private async Task DoPersistentConnection(SocketDelegate socketDelegate,
IHttpTransport transport, IHttpTransport transport,
HttpContext context, HttpContext context,
DefaultConnectionContext connection) DefaultConnectionContext connection)
@ -324,7 +323,7 @@ namespace Microsoft.AspNetCore.Sockets
connection.Status = DefaultConnectionContext.ConnectionStatus.Active; connection.Status = DefaultConnectionContext.ConnectionStatus.Active;
// Call into the end point passing the connection // Call into the end point passing the connection
connection.ApplicationTask = ExecuteApplication(ConnectionDelegate, connection); connection.ApplicationTask = ExecuteApplication(socketDelegate, connection);
// Start the transport // Start the transport
connection.TransportTask = transport.ProcessRequestAsync(context, context.RequestAborted); connection.TransportTask = transport.ProcessRequestAsync(context, context.RequestAborted);
@ -340,12 +339,12 @@ namespace Microsoft.AspNetCore.Sockets
await _manager.DisposeAndRemoveAsync(connection); await _manager.DisposeAndRemoveAsync(connection);
} }
private async Task ExecuteApplication(ConnectionDelegate ConnectionDelegate, ConnectionContext connection) private async Task ExecuteApplication(SocketDelegate socketDelegate, ConnectionContext connection)
{ {
// Verify some initialization invariants // Verify some initialization invariants
// We want to be positive that the IConnectionInherentKeepAliveFeature is initialized before invoking the application, if the long polling transport is in use. // We want to be positive that the IConnectionInherentKeepAliveFeature is initialized before invoking the application, if the long polling transport is in use.
Debug.Assert(connection.Features.Get<IConnectionMetadataFeature>().Metadata[ConnectionMetadataNames.Transport] != null, "Transport has not been initialized yet"); Debug.Assert(connection.Metadata[ConnectionMetadataNames.Transport] != null, "Transport has not been initialized yet");
Debug.Assert((TransportType?)connection.Features.Get<IConnectionMetadataFeature>().Metadata[ConnectionMetadataNames.Transport] != TransportType.LongPolling || Debug.Assert((TransportType?)connection.Metadata[ConnectionMetadataNames.Transport] != TransportType.LongPolling ||
connection.Features.Get<IConnectionInherentKeepAliveFeature>() != null, "Long-polling transport is in use but IConnectionInherentKeepAliveFeature as not configured"); connection.Features.Get<IConnectionInherentKeepAliveFeature>() != null, "Long-polling transport is in use but IConnectionInherentKeepAliveFeature as not configured");
// Jump onto the thread pool thread so blocking user code doesn't block the setup of the // Jump onto the thread pool thread so blocking user code doesn't block the setup of the
@ -353,7 +352,7 @@ namespace Microsoft.AspNetCore.Sockets
await AwaitableThreadPool.Yield(); await AwaitableThreadPool.Yield();
// Running this in an async method turns sync exceptions into async ones // Running this in an async method turns sync exceptions into async ones
await ConnectionDelegate(connection); await socketDelegate(connection);
} }
private Task ProcessNegotiate(HttpContext context, HttpSocketOptions options, ConnectionLogScope logScope) private Task ProcessNegotiate(HttpContext context, HttpSocketOptions options, ConnectionLogScope logScope)

View File

@ -5,7 +5,6 @@ using System;
using System.Reflection; using System.Reflection;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Protocols;
using Microsoft.AspNetCore.Routing; using Microsoft.AspNetCore.Routing;
namespace Microsoft.AspNetCore.Sockets namespace Microsoft.AspNetCore.Sockets
@ -21,15 +20,15 @@ namespace Microsoft.AspNetCore.Sockets
_dispatcher = dispatcher; _dispatcher = dispatcher;
} }
public void MapSocket(string path, Action<IConnectionBuilder> socketConfig) => public void MapSocket(string path, Action<ISocketBuilder> socketConfig) =>
MapSocket(new PathString(path), new HttpSocketOptions(), socketConfig); MapSocket(new PathString(path), new HttpSocketOptions(), socketConfig);
public void MapSocket(PathString path, Action<IConnectionBuilder> socketConfig) => public void MapSocket(PathString path, Action<ISocketBuilder> socketConfig) =>
MapSocket(path, new HttpSocketOptions(), socketConfig); MapSocket(path, new HttpSocketOptions(), socketConfig);
public void MapSocket(PathString path, HttpSocketOptions options, Action<IConnectionBuilder> socketConfig) public void MapSocket(PathString path, HttpSocketOptions options, Action<ISocketBuilder> socketConfig)
{ {
var socketBuilder = new ConnectionBuilder(_routes.ServiceProvider); var socketBuilder = new SocketBuilder(_routes.ServiceProvider);
socketConfig(socketBuilder); socketConfig(socketBuilder);
var socket = socketBuilder.Build(); var socket = socketBuilder.Build();
_routes.MapRoute(path, c => _dispatcher.ExecuteAsync(c, options, socket)); _routes.MapRoute(path, c => _dispatcher.ExecuteAsync(c, options, socket));

View File

@ -5,7 +5,6 @@ using System;
using System.Collections; using System.Collections;
using System.Collections.Concurrent; using System.Collections.Concurrent;
using System.Collections.Generic; using System.Collections.Generic;
using Microsoft.AspNetCore.Protocols;
namespace Microsoft.AspNetCore.Sockets namespace Microsoft.AspNetCore.Sockets
{ {

View File

@ -2,14 +2,12 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System; using System;
using System.Buffers;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO.Pipelines; using System.IO.Pipelines;
using System.Security.Claims; using System.Security.Claims;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Http.Features; using Microsoft.AspNetCore.Http.Features;
using Microsoft.AspNetCore.Protocols;
using Microsoft.AspNetCore.Sockets.Features; using Microsoft.AspNetCore.Sockets.Features;
using Microsoft.Extensions.Internal; using Microsoft.Extensions.Internal;
@ -65,7 +63,7 @@ namespace Microsoft.AspNetCore.Sockets
public ClaimsPrincipal User { get; set; } public ClaimsPrincipal User { get; set; }
public IDictionary<object, object> Metadata { get; set; } = new ConnectionMetadata(); public override IDictionary<object, object> Metadata { get; set; } = new ConnectionMetadata();
public IDuplexPipe Application { get; } public IDuplexPipe Application { get; }
@ -75,8 +73,6 @@ namespace Microsoft.AspNetCore.Sockets
public TransferMode TransferMode { get; set; } public TransferMode TransferMode { get; set; }
public override MemoryPool MemoryPool { get; }
public void OnHeartbeat(Action<object> action, object state) public void OnHeartbeat(Action<object> action, object state)
{ {
lock (_heartbeatHandlers) lock (_heartbeatHandlers)

View File

@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Protocols;
namespace Microsoft.AspNetCore.Sockets namespace Microsoft.AspNetCore.Sockets
{ {

View File

@ -1,14 +1,13 @@
// Copyright (c) .NET Foundation. All rights reserved. // 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. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.AspNetCore.Protocols;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
namespace Microsoft.AspNetCore.Sockets namespace Microsoft.AspNetCore.Sockets
{ {
public static class SocketBuilderExtensions public static class SocketBuilderExtensions
{ {
public static IConnectionBuilder UseEndPoint<TEndPoint>(this IConnectionBuilder socketBuilder) where TEndPoint : EndPoint public static ISocketBuilder UseEndPoint<TEndPoint>(this ISocketBuilder socketBuilder) where TEndPoint : EndPoint
{ {
var endpoint = socketBuilder.ApplicationServices.GetRequiredService<TEndPoint>(); var endpoint = socketBuilder.ApplicationServices.GetRequiredService<TEndPoint>();
// This is a terminal middleware, so there's no need to use the 'next' parameter // This is a terminal middleware, so there's no need to use the 'next' parameter

View File

@ -3,7 +3,6 @@
using System.IO.Pipelines; using System.IO.Pipelines;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Protocols;
using Microsoft.AspNetCore.Sockets; using Microsoft.AspNetCore.Sockets;
namespace Microsoft.AspNetCore.SignalR.Tests namespace Microsoft.AspNetCore.SignalR.Tests

View File

@ -3,7 +3,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Microsoft.AspNetCore.Protocols;
using Microsoft.AspNetCore.SignalR.Internal; using Microsoft.AspNetCore.SignalR.Internal;
using Microsoft.AspNetCore.SignalR.Internal.Protocol; using Microsoft.AspNetCore.SignalR.Internal.Protocol;
using Microsoft.AspNetCore.Sockets; using Microsoft.AspNetCore.Sockets;

View File

@ -15,7 +15,6 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Features; using Microsoft.AspNetCore.Http.Features;
using Microsoft.AspNetCore.Http.Internal; using Microsoft.AspNetCore.Http.Internal;
using Microsoft.AspNetCore.Protocols;
using Microsoft.AspNetCore.Sockets.Features; using Microsoft.AspNetCore.Sockets.Features;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
@ -117,7 +116,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
context.Request.Query = qs; context.Request.Query = qs;
SetTransport(context, transportType); SetTransport(context, transportType);
var builder = new ConnectionBuilder(services.BuildServiceProvider()); var builder = new SocketBuilder(services.BuildServiceProvider());
builder.UseEndPoint<TestEndPoint>(); builder.UseEndPoint<TestEndPoint>();
var app = builder.Build(); var app = builder.Build();
await dispatcher.ExecuteAsync(context, new HttpSocketOptions(), app); await dispatcher.ExecuteAsync(context, new HttpSocketOptions(), app);
@ -152,7 +151,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
var qs = new QueryCollection(values); var qs = new QueryCollection(values);
context.Request.Query = qs; context.Request.Query = qs;
var builder = new ConnectionBuilder(services.BuildServiceProvider()); var builder = new SocketBuilder(services.BuildServiceProvider());
builder.UseEndPoint<TestEndPoint>(); builder.UseEndPoint<TestEndPoint>();
var app = builder.Build(); var app = builder.Build();
await dispatcher.ExecuteAsync(context, new HttpSocketOptions(), app); await dispatcher.ExecuteAsync(context, new HttpSocketOptions(), app);
@ -189,7 +188,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
var qs = new QueryCollection(values); var qs = new QueryCollection(values);
context.Request.Query = qs; context.Request.Query = qs;
var builder = new ConnectionBuilder(services.BuildServiceProvider()); var builder = new SocketBuilder(services.BuildServiceProvider());
builder.UseEndPoint<TestEndPoint>(); builder.UseEndPoint<TestEndPoint>();
var app = builder.Build(); var app = builder.Build();
await dispatcher.ExecuteAsync(context, new HttpSocketOptions(), app); await dispatcher.ExecuteAsync(context, new HttpSocketOptions(), app);
@ -234,7 +233,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
var qs = new QueryCollection(values); var qs = new QueryCollection(values);
context.Request.Query = qs; context.Request.Query = qs;
var builder = new ConnectionBuilder(services.BuildServiceProvider()); var builder = new SocketBuilder(services.BuildServiceProvider());
builder.UseEndPoint<TestEndPoint>(); builder.UseEndPoint<TestEndPoint>();
var app = builder.Build(); var app = builder.Build();
@ -269,7 +268,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
SetTransport(context, transportType); SetTransport(context, transportType);
var builder = new ConnectionBuilder(services.BuildServiceProvider()); var builder = new SocketBuilder(services.BuildServiceProvider());
builder.UseEndPoint<TestEndPoint>(); builder.UseEndPoint<TestEndPoint>();
var app = builder.Build(); var app = builder.Build();
await dispatcher.ExecuteAsync(context, new HttpSocketOptions(), app); await dispatcher.ExecuteAsync(context, new HttpSocketOptions(), app);
@ -298,7 +297,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
context.Request.Path = "/foo"; context.Request.Path = "/foo";
context.Request.Method = "POST"; context.Request.Method = "POST";
var builder = new ConnectionBuilder(services.BuildServiceProvider()); var builder = new SocketBuilder(services.BuildServiceProvider());
builder.UseEndPoint<TestEndPoint>(); builder.UseEndPoint<TestEndPoint>();
var app = builder.Build(); var app = builder.Build();
await dispatcher.ExecuteAsync(context, new HttpSocketOptions(), app); await dispatcher.ExecuteAsync(context, new HttpSocketOptions(), app);
@ -371,7 +370,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
var services = new ServiceCollection(); var services = new ServiceCollection();
services.AddEndPoint<ImmediatelyCompleteEndPoint>(); services.AddEndPoint<ImmediatelyCompleteEndPoint>();
var builder = new ConnectionBuilder(services.BuildServiceProvider()); var builder = new SocketBuilder(services.BuildServiceProvider());
builder.UseEndPoint<ImmediatelyCompleteEndPoint>(); builder.UseEndPoint<ImmediatelyCompleteEndPoint>();
var app = builder.Build(); var app = builder.Build();
await dispatcher.ExecuteAsync(context, new HttpSocketOptions(), app); await dispatcher.ExecuteAsync(context, new HttpSocketOptions(), app);
@ -397,7 +396,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
var services = new ServiceCollection(); var services = new ServiceCollection();
services.AddEndPoint<SynchronusExceptionEndPoint>(); services.AddEndPoint<SynchronusExceptionEndPoint>();
var builder = new ConnectionBuilder(services.BuildServiceProvider()); var builder = new SocketBuilder(services.BuildServiceProvider());
builder.UseEndPoint<SynchronusExceptionEndPoint>(); builder.UseEndPoint<SynchronusExceptionEndPoint>();
var app = builder.Build(); var app = builder.Build();
await dispatcher.ExecuteAsync(context, new HttpSocketOptions(), app); await dispatcher.ExecuteAsync(context, new HttpSocketOptions(), app);
@ -423,7 +422,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
var services = new ServiceCollection(); var services = new ServiceCollection();
services.AddEndPoint<ImmediatelyCompleteEndPoint>(); services.AddEndPoint<ImmediatelyCompleteEndPoint>();
var builder = new ConnectionBuilder(services.BuildServiceProvider()); var builder = new SocketBuilder(services.BuildServiceProvider());
builder.UseEndPoint<ImmediatelyCompleteEndPoint>(); builder.UseEndPoint<ImmediatelyCompleteEndPoint>();
var app = builder.Build(); var app = builder.Build();
await dispatcher.ExecuteAsync(context, new HttpSocketOptions(), app); await dispatcher.ExecuteAsync(context, new HttpSocketOptions(), app);
@ -449,7 +448,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
var services = new ServiceCollection(); var services = new ServiceCollection();
services.AddEndPoint<TestEndPoint>(); services.AddEndPoint<TestEndPoint>();
var builder = new ConnectionBuilder(services.BuildServiceProvider()); var builder = new SocketBuilder(services.BuildServiceProvider());
builder.UseEndPoint<TestEndPoint>(); builder.UseEndPoint<TestEndPoint>();
var app = builder.Build(); var app = builder.Build();
var options = new HttpSocketOptions(); var options = new HttpSocketOptions();
@ -475,7 +474,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
var services = new ServiceCollection(); var services = new ServiceCollection();
services.AddEndPoint<ImmediatelyCompleteEndPoint>(); services.AddEndPoint<ImmediatelyCompleteEndPoint>();
var builder = new ConnectionBuilder(services.BuildServiceProvider()); var builder = new SocketBuilder(services.BuildServiceProvider());
builder.UseEndPoint<ImmediatelyCompleteEndPoint>(); builder.UseEndPoint<ImmediatelyCompleteEndPoint>();
var app = builder.Build(); var app = builder.Build();
var options = new HttpSocketOptions(); var options = new HttpSocketOptions();
@ -507,7 +506,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
var services = new ServiceCollection(); var services = new ServiceCollection();
services.AddEndPoint<TestEndPoint>(); services.AddEndPoint<TestEndPoint>();
var builder = new ConnectionBuilder(services.BuildServiceProvider()); var builder = new SocketBuilder(services.BuildServiceProvider());
builder.UseEndPoint<TestEndPoint>(); builder.UseEndPoint<TestEndPoint>();
var app = builder.Build(); var app = builder.Build();
var options = new HttpSocketOptions(); var options = new HttpSocketOptions();
@ -546,7 +545,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
var services = new ServiceCollection(); var services = new ServiceCollection();
services.AddEndPoint<TestEndPoint>(); services.AddEndPoint<TestEndPoint>();
var builder = new ConnectionBuilder(services.BuildServiceProvider()); var builder = new SocketBuilder(services.BuildServiceProvider());
builder.UseEndPoint<TestEndPoint>(); builder.UseEndPoint<TestEndPoint>();
var app = builder.Build(); var app = builder.Build();
var options = new HttpSocketOptions(); var options = new HttpSocketOptions();
@ -584,7 +583,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
var services = new ServiceCollection(); var services = new ServiceCollection();
services.AddEndPoint<TestEndPoint>(); services.AddEndPoint<TestEndPoint>();
var builder = new ConnectionBuilder(services.BuildServiceProvider()); var builder = new SocketBuilder(services.BuildServiceProvider());
builder.UseEndPoint<TestEndPoint>(); builder.UseEndPoint<TestEndPoint>();
var app = builder.Build(); var app = builder.Build();
var options = new HttpSocketOptions(); var options = new HttpSocketOptions();
@ -609,7 +608,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
var services = new ServiceCollection(); var services = new ServiceCollection();
services.AddEndPoint<TestEndPoint>(); services.AddEndPoint<TestEndPoint>();
var builder = new ConnectionBuilder(services.BuildServiceProvider()); var builder = new SocketBuilder(services.BuildServiceProvider());
builder.UseEndPoint<TestEndPoint>(); builder.UseEndPoint<TestEndPoint>();
var app = builder.Build(); var app = builder.Build();
var options = new HttpSocketOptions(); var options = new HttpSocketOptions();
@ -644,7 +643,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
var services = new ServiceCollection(); var services = new ServiceCollection();
services.AddEndPoint<BlockingEndPoint>(); services.AddEndPoint<BlockingEndPoint>();
var builder = new ConnectionBuilder(services.BuildServiceProvider()); var builder = new SocketBuilder(services.BuildServiceProvider());
builder.UseEndPoint<BlockingEndPoint>(); builder.UseEndPoint<BlockingEndPoint>();
var app = builder.Build(); var app = builder.Build();
var options = new HttpSocketOptions(); var options = new HttpSocketOptions();
@ -677,7 +676,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
var services = new ServiceCollection(); var services = new ServiceCollection();
services.AddEndPoint<BlockingEndPoint>(); services.AddEndPoint<BlockingEndPoint>();
var builder = new ConnectionBuilder(services.BuildServiceProvider()); var builder = new SocketBuilder(services.BuildServiceProvider());
builder.UseEndPoint<BlockingEndPoint>(); builder.UseEndPoint<BlockingEndPoint>();
var app = builder.Build(); var app = builder.Build();
var options = new HttpSocketOptions(); var options = new HttpSocketOptions();
@ -708,7 +707,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
var services = new ServiceCollection(); var services = new ServiceCollection();
services.AddEndPoint<TestEndPoint>(); services.AddEndPoint<TestEndPoint>();
var builder = new ConnectionBuilder(services.BuildServiceProvider()); var builder = new SocketBuilder(services.BuildServiceProvider());
builder.UseEndPoint<TestEndPoint>(); builder.UseEndPoint<TestEndPoint>();
var app = builder.Build(); var app = builder.Build();
var options = new HttpSocketOptions(); var options = new HttpSocketOptions();
@ -752,7 +751,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
var services = new ServiceCollection(); var services = new ServiceCollection();
services.AddEndPoint<ImmediatelyCompleteEndPoint>(); services.AddEndPoint<ImmediatelyCompleteEndPoint>();
var builder = new ConnectionBuilder(services.BuildServiceProvider()); var builder = new SocketBuilder(services.BuildServiceProvider());
builder.UseEndPoint<ImmediatelyCompleteEndPoint>(); builder.UseEndPoint<ImmediatelyCompleteEndPoint>();
var app = builder.Build(); var app = builder.Build();
@ -796,7 +795,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
var qs = new QueryCollection(values); var qs = new QueryCollection(values);
context.Request.Query = qs; context.Request.Query = qs;
var builder = new ConnectionBuilder(sp); var builder = new SocketBuilder(sp);
builder.UseEndPoint<TestEndPoint>(); builder.UseEndPoint<TestEndPoint>();
var app = builder.Build(); var app = builder.Build();
var options = new HttpSocketOptions(); var options = new HttpSocketOptions();
@ -841,7 +840,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
var qs = new QueryCollection(values); var qs = new QueryCollection(values);
context.Request.Query = qs; context.Request.Query = qs;
var builder = new ConnectionBuilder(sp); var builder = new SocketBuilder(sp);
builder.UseEndPoint<TestEndPoint>(); builder.UseEndPoint<TestEndPoint>();
var app = builder.Build(); var app = builder.Build();
var options = new HttpSocketOptions(); var options = new HttpSocketOptions();
@ -893,7 +892,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
context.Request.Query = qs; context.Request.Query = qs;
context.Response.Body = new MemoryStream(); context.Response.Body = new MemoryStream();
var builder = new ConnectionBuilder(sp); var builder = new SocketBuilder(sp);
builder.UseEndPoint<TestEndPoint>(); builder.UseEndPoint<TestEndPoint>();
var app = builder.Build(); var app = builder.Build();
var options = new HttpSocketOptions(); var options = new HttpSocketOptions();
@ -953,7 +952,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
context.Request.Query = qs; context.Request.Query = qs;
context.Response.Body = new MemoryStream(); context.Response.Body = new MemoryStream();
var builder = new ConnectionBuilder(sp); var builder = new SocketBuilder(sp);
builder.UseEndPoint<TestEndPoint>(); builder.UseEndPoint<TestEndPoint>();
var app = builder.Build(); var app = builder.Build();
var options = new HttpSocketOptions(); var options = new HttpSocketOptions();
@ -1031,7 +1030,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
context.Request.Query = qs; context.Request.Query = qs;
context.Response.Body = new MemoryStream(); context.Response.Body = new MemoryStream();
var builder = new ConnectionBuilder(sp); var builder = new SocketBuilder(sp);
builder.UseEndPoint<TestEndPoint>(); builder.UseEndPoint<TestEndPoint>();
var app = builder.Build(); var app = builder.Build();
var options = new HttpSocketOptions(); var options = new HttpSocketOptions();
@ -1087,7 +1086,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
context.Request.Query = qs; context.Request.Query = qs;
context.Response.Body = new MemoryStream(); context.Response.Body = new MemoryStream();
var builder = new ConnectionBuilder(sp); var builder = new SocketBuilder(sp);
builder.UseEndPoint<TestEndPoint>(); builder.UseEndPoint<TestEndPoint>();
var app = builder.Build(); var app = builder.Build();
var options = new HttpSocketOptions(); var options = new HttpSocketOptions();
@ -1117,7 +1116,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
var services = new ServiceCollection(); var services = new ServiceCollection();
services.AddEndPoint<TestEndPoint>(); services.AddEndPoint<TestEndPoint>();
var builder = new ConnectionBuilder(services.BuildServiceProvider()); var builder = new SocketBuilder(services.BuildServiceProvider());
builder.UseEndPoint<TestEndPoint>(); builder.UseEndPoint<TestEndPoint>();
var app = builder.Build(); var app = builder.Build();
var options = new HttpSocketOptions(); var options = new HttpSocketOptions();
@ -1197,7 +1196,7 @@ namespace Microsoft.AspNetCore.Sockets.Tests
var qs = new QueryCollection(values); var qs = new QueryCollection(values);
context.Request.Query = qs; context.Request.Query = qs;
var builder = new ConnectionBuilder(services.BuildServiceProvider()); var builder = new SocketBuilder(services.BuildServiceProvider());
builder.UseEndPoint<ImmediatelyCompleteEndPoint>(); builder.UseEndPoint<ImmediatelyCompleteEndPoint>();
var app = builder.Build(); var app = builder.Build();
var options = new HttpSocketOptions(); var options = new HttpSocketOptions();

View File

@ -10,7 +10,6 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Hosting.Server.Features; using Microsoft.AspNetCore.Hosting.Server.Features;
using Microsoft.AspNetCore.Protocols;
using Microsoft.AspNetCore.Testing.xunit; using Microsoft.AspNetCore.Testing.xunit;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;