Construct ThreadPoolActions in KestrelServer

This commit is contained in:
Ben Adams 2015-12-03 03:27:11 +00:00
parent 5ae9b3c383
commit 850d2b0c7e
2 changed files with 7 additions and 17 deletions

View File

@ -7,6 +7,7 @@ using Microsoft.AspNet.Hosting;
using Microsoft.AspNet.Hosting.Server; using Microsoft.AspNet.Hosting.Server;
using Microsoft.AspNet.Http.Features; using Microsoft.AspNet.Http.Features;
using Microsoft.AspNet.Server.Kestrel.Http; using Microsoft.AspNet.Server.Kestrel.Http;
using Microsoft.AspNet.Server.Kestrel.Infrastructure;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
namespace Microsoft.AspNet.Server.Kestrel namespace Microsoft.AspNet.Server.Kestrel
@ -54,6 +55,7 @@ namespace Microsoft.AspNet.Server.Kestrel
{ {
var information = (KestrelServerInformation)Features.Get<IKestrelServerInformation>(); var information = (KestrelServerInformation)Features.Get<IKestrelServerInformation>();
var dateHeaderValueManager = new DateHeaderValueManager(); var dateHeaderValueManager = new DateHeaderValueManager();
var trace = new KestrelTrace(_logger);
var engine = new KestrelEngine(new ServiceContext var engine = new KestrelEngine(new ServiceContext
{ {
FrameFactory = (context, remoteEP, localEP, prepareRequest) => FrameFactory = (context, remoteEP, localEP, prepareRequest) =>
@ -61,7 +63,8 @@ namespace Microsoft.AspNet.Server.Kestrel
return new Frame<TContext>(application, context, remoteEP, localEP, prepareRequest); return new Frame<TContext>(application, context, remoteEP, localEP, prepareRequest);
}, },
AppLifetime = _applicationLifetime, AppLifetime = _applicationLifetime,
Log = new KestrelTrace(_logger), Log = trace,
ThreadPoolActions = new ThreadPoolActions(trace),
DateHeaderValueManager = dateHeaderValueManager, DateHeaderValueManager = dateHeaderValueManager,
ConnectionFilter = information.ConnectionFilter, ConnectionFilter = information.ConnectionFilter,
NoDelay = information.NoDelay NoDelay = information.NoDelay

View File

@ -13,8 +13,6 @@ namespace Microsoft.AspNet.Server.Kestrel
{ {
public class ServiceContext public class ServiceContext
{ {
private IKestrelTrace _log;
public ServiceContext() public ServiceContext()
{ {
} }
@ -22,7 +20,7 @@ namespace Microsoft.AspNet.Server.Kestrel
public ServiceContext(ServiceContext context) public ServiceContext(ServiceContext context)
{ {
AppLifetime = context.AppLifetime; AppLifetime = context.AppLifetime;
_log = context.Log; Log = context.Log;
ThreadPoolActions = context.ThreadPoolActions; ThreadPoolActions = context.ThreadPoolActions;
FrameFactory = context.FrameFactory; FrameFactory = context.FrameFactory;
DateHeaderValueManager = context.DateHeaderValueManager; DateHeaderValueManager = context.DateHeaderValueManager;
@ -32,20 +30,9 @@ namespace Microsoft.AspNet.Server.Kestrel
public IApplicationLifetime AppLifetime { get; set; } public IApplicationLifetime AppLifetime { get; set; }
public IKestrelTrace Log public IKestrelTrace Log { get; set; }
{
get
{
return _log;
}
set
{
_log = value;
ThreadPoolActions = new ThreadPoolActions(_log);
}
}
public ThreadPoolActions ThreadPoolActions { get; private set; } public ThreadPoolActions ThreadPoolActions { get; set; }
public Func<ConnectionContext, IPEndPoint, IPEndPoint, Action<IFeatureCollection>, Frame> FrameFactory { get; set; } public Func<ConnectionContext, IPEndPoint, IPEndPoint, Action<IFeatureCollection>, Frame> FrameFactory { get; set; }