Change IServerInformation to IFeatureCollection.

This commit is contained in:
Chris R 2015-08-31 17:09:54 -07:00
parent e8b6908b04
commit c2192d7bd1
2 changed files with 9 additions and 16 deletions

View File

@ -3,14 +3,13 @@
using System;
using System.Collections.Generic;
using Microsoft.AspNet.Hosting.Server;
using Microsoft.Framework.Configuration;
namespace Microsoft.AspNet.Server.Kestrel
{
public class ServerInformation : IServerInformation, IKestrelServerInformation
public class KestrelServerInformation : IKestrelServerInformation
{
public ServerInformation()
public KestrelServerInformation()
{
Addresses = new List<ServerAddress>();
}
@ -32,14 +31,6 @@ namespace Microsoft.AspNet.Server.Kestrel
}
}
public string Name
{
get
{
return "Kestrel";
}
}
public IList<ServerAddress> Addresses { get; private set; }
public int ThreadCount { get; set; }

View File

@ -25,17 +25,19 @@ namespace Microsoft.AspNet.Server.Kestrel
_appShutdownService = appShutdownService;
}
public IServerInformation Initialize(IConfiguration configuration)
public IFeatureCollection Initialize(IConfiguration configuration)
{
var information = new ServerInformation();
var information = new KestrelServerInformation();
information.Initialize(configuration);
return information;
var serverFeatures = new FeatureCollection();
serverFeatures.Set<IKestrelServerInformation>(information);
return serverFeatures;
}
public IDisposable Start(IServerInformation serverInformation, Func<IFeatureCollection, Task> application)
public IDisposable Start(IFeatureCollection serverFeatures, Func<IFeatureCollection, Task> application)
{
var disposables = new List<IDisposable>();
var information = (ServerInformation)serverInformation;
var information = (KestrelServerInformation)serverFeatures.Get<IKestrelServerInformation>();
var engine = new KestrelEngine(_libraryManager, _appShutdownService);
engine.Start(information.ThreadCount == 0 ? 1 : information.ThreadCount);
foreach (var address in information.Addresses)