Adding an IKestralServerInformation.ThreadCount property

Will default to 1 until multi-loop stability is ensured
This commit is contained in:
Louis DeJardin 2015-07-27 11:40:39 -07:00
parent 10bce6a2ec
commit 5e6e5fec01
3 changed files with 15 additions and 3 deletions

View File

@ -0,0 +1,10 @@
// 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.
namespace Kestrel
{
public interface IKestrelServerInformation
{
int ThreadCount { get; set; }
}
}

View File

@ -38,7 +38,7 @@ namespace Kestrel
var disposables = new List<IDisposable>();
var information = (ServerInformation)serverInformation;
var engine = new KestrelEngine(_libraryManager, _appShutdownService);
engine.Start(Environment.ProcessorCount);
engine.Start(information.ThreadCount == 0 ? 1 : information.ThreadCount);
foreach (var address in information.Addresses)
{
disposables.Add(engine.CreateServer(

View File

@ -8,7 +8,7 @@ using Microsoft.Framework.Configuration;
namespace Kestrel
{
public class ServerInformation : IServerInformation
public class ServerInformation : IServerInformation, IKestrelServerInformation
{
public ServerInformation()
{
@ -25,7 +25,7 @@ namespace Kestrel
foreach (var url in urls.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries))
{
var address = ServerAddress.FromUrl(url);
if(address != null)
if (address != null)
{
Addresses.Add(address);
}
@ -41,5 +41,7 @@ namespace Kestrel
}
public IList<ServerAddress> Addresses { get; private set; }
public int ThreadCount { get; set; }
}
}