Revert "React to hosting changes"

This reverts commit f48bd8d185.
This commit is contained in:
David Fowler 2016-12-13 23:56:10 -08:00
parent f48bd8d185
commit 12649b19bf
2 changed files with 11 additions and 5 deletions

View File

@ -6,20 +6,26 @@ using Microsoft.AspNetCore.Hosting;
namespace Microsoft.AspNetCore.Sockets
{
public class SocketsApplicationLifetimeService : IHostedService
public class SocketsApplicationLifetimeEvents : IApplicationLifetimeEvents
{
private readonly ConnectionManager _connectionManager;
public SocketsApplicationLifetimeService(ConnectionManager connectionManager)
public SocketsApplicationLifetimeEvents(ConnectionManager connectionManager)
{
_connectionManager = connectionManager;
}
public void Start()
public void OnApplicationStarted()
{
}
public void Stop()
public void OnApplicationStopped()
{
}
public void OnApplicationStopping()
{
_connectionManager.CloseConnections();
}

View File

@ -14,7 +14,7 @@ namespace Microsoft.Extensions.DependencyInjection
{
services.AddRouting();
services.TryAddSingleton<ConnectionManager>();
services.TryAddEnumerable(ServiceDescriptor.Singleton<IHostedService, SocketsApplicationLifetimeService>());
services.TryAddEnumerable(ServiceDescriptor.Singleton<IApplicationLifetimeEvents, SocketsApplicationLifetimeEvents>());
services.TryAddSingleton<PipelineFactory>();
services.TryAddSingleton<HttpConnectionDispatcher>();
return services;