public KestrelServer(IOptions <KestrelServerOptions> options, IApplicationLifetime applicationLifetime, ILoggerFactory loggerFactory) { if (options == null) { throw new ArgumentNullException(nameof(options)); } if (applicationLifetime == null) { throw new ArgumentNullException(nameof(applicationLifetime)); } if (loggerFactory == null) { throw new ArgumentNullException(nameof(loggerFactory)); } Options = options.Value ?? new KestrelServerOptions(); _applicationLifetime = applicationLifetime; _logger = loggerFactory.CreateLogger(typeof(KestrelServer).GetTypeInfo().Assembly.FullName); Features = new FeatureCollection(); var componentFactory = new HttpComponentFactory(Options); Features.Set <IHttpComponentFactory>(componentFactory); _serverAddresses = new ServerAddressesFeature(); Features.Set <IServerAddressesFeature>(_serverAddresses); }
public void InitializeStreams(MessageBody messageBody) { _frameStreams = HttpComponentFactory.CreateStreams(this); RequestBody = _frameStreams.RequestBody.StartAcceptingReads(messageBody); ResponseBody = _frameStreams.ResponseBody.StartAcceptingWrites(); DuplexStream = _frameStreams.DuplexStream; }
public TestServiceContext() { AppLifetime = new LifetimeNotImplemented(); Log = new TestKestrelTrace(); ThreadPool = new LoggingThreadPool(Log); DateHeaderValueManager = new TestDateHeaderValueManager(); ServerOptions = new KestrelServerOptions(); ServerOptions.ShutdownTimeout = TimeSpan.FromSeconds(5); HttpComponentFactory = new HttpComponentFactory(ServerOptions); }
protected void ResetComponents() { var frameHeaders = Interlocked.Exchange(ref _frameHeaders, null); if (frameHeaders != null) { RequestHeaders = null; ResponseHeaders = null; HttpComponentFactory.DisposeHeaders(frameHeaders); } var frameStreams = Interlocked.Exchange(ref _frameStreams, null); if (frameStreams != null) { RequestBody = null; ResponseBody = null; DuplexStream = null; HttpComponentFactory.DisposeStreams(frameStreams); } }
public void InitializeHeaders() { _frameHeaders = HttpComponentFactory.CreateHeaders(DateHeaderValueManager); RequestHeaders = _frameHeaders.RequestHeaders; ResponseHeaders = _frameHeaders.ResponseHeaders; }