Adding an IKestralServerInformation.ThreadCount property
Will default to 1 until multi-loop stability is ensured
This commit is contained in:
parent
10bce6a2ec
commit
5e6e5fec01
|
|
@ -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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -38,7 +38,7 @@ namespace Kestrel
|
||||||
var disposables = new List<IDisposable>();
|
var disposables = new List<IDisposable>();
|
||||||
var information = (ServerInformation)serverInformation;
|
var information = (ServerInformation)serverInformation;
|
||||||
var engine = new KestrelEngine(_libraryManager, _appShutdownService);
|
var engine = new KestrelEngine(_libraryManager, _appShutdownService);
|
||||||
engine.Start(Environment.ProcessorCount);
|
engine.Start(information.ThreadCount == 0 ? 1 : information.ThreadCount);
|
||||||
foreach (var address in information.Addresses)
|
foreach (var address in information.Addresses)
|
||||||
{
|
{
|
||||||
disposables.Add(engine.CreateServer(
|
disposables.Add(engine.CreateServer(
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ using Microsoft.Framework.Configuration;
|
||||||
|
|
||||||
namespace Kestrel
|
namespace Kestrel
|
||||||
{
|
{
|
||||||
public class ServerInformation : IServerInformation
|
public class ServerInformation : IServerInformation, IKestrelServerInformation
|
||||||
{
|
{
|
||||||
public ServerInformation()
|
public ServerInformation()
|
||||||
{
|
{
|
||||||
|
|
@ -25,7 +25,7 @@ namespace Kestrel
|
||||||
foreach (var url in urls.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries))
|
foreach (var url in urls.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries))
|
||||||
{
|
{
|
||||||
var address = ServerAddress.FromUrl(url);
|
var address = ServerAddress.FromUrl(url);
|
||||||
if(address != null)
|
if (address != null)
|
||||||
{
|
{
|
||||||
Addresses.Add(address);
|
Addresses.Add(address);
|
||||||
}
|
}
|
||||||
|
|
@ -41,5 +41,7 @@ namespace Kestrel
|
||||||
}
|
}
|
||||||
|
|
||||||
public IList<ServerAddress> Addresses { get; private set; }
|
public IList<ServerAddress> Addresses { get; private set; }
|
||||||
|
|
||||||
|
public int ThreadCount { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue