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

View File

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