private Http1OutputProducer CreateOutputProducer(PipeOptions pipeOptions) { var pipe = new Pipe(pipeOptions); var serviceContext = new TestServiceContext(); var socketOutput = new Http1OutputProducer( pipe.Reader, pipe.Writer, "0", serviceContext.Log, Mock.Of <ITimeoutControl>()); return(socketOutput); }
private Http1OutputProducer CreateOutputProducer( PipeOptions pipeOptions = null, ConnectionContext connectionContext = null) { pipeOptions = pipeOptions ?? new PipeOptions(); connectionContext = connectionContext ?? Mock.Of <ConnectionContext>(); var pipe = new Pipe(pipeOptions); var serviceContext = new TestServiceContext(); var socketOutput = new Http1OutputProducer( pipe.Writer, "0", connectionContext, serviceContext.Log, Mock.Of <ITimeoutControl>(), Mock.Of <IBytesWrittenFeature>()); return(socketOutput); }
private Http1OutputProducer CreateOutputProducer( PipeOptions pipeOptions = null, IConnectionLifetimeFeature lifetimeFeature = null) { pipeOptions = pipeOptions ?? new PipeOptions(); lifetimeFeature = lifetimeFeature ?? Mock.Of <IConnectionLifetimeFeature>(); var pipe = new Pipe(pipeOptions); var serviceContext = new TestServiceContext(); var socketOutput = new Http1OutputProducer( pipe.Reader, pipe.Writer, "0", serviceContext.Log, Mock.Of <ITimeoutControl>(), lifetimeFeature, Mock.Of <IBytesWrittenFeature>()); return(socketOutput); }
static ValueTask <FlushResult> FlushAsyncChunked(Http1OutputProducer producer, CancellationToken token) { // Local function so in the common-path the stack space for BufferWriter isn't reserved and cleared when it isn't used. Debug.Assert(!producer._pipeWriterCompleted); Debug.Assert(producer._autoChunk && producer._advancedBytesForChunk > 0); var writer = new BufferWriter <PipeWriter>(producer._pipeWriter); producer.WriteCurrentChunkMemoryToPipeWriter(ref writer); writer.Commit(); var bytesWritten = producer._unflushedBytes + writer.BytesCommitted; producer._unflushedBytes = 0; // If there is an empty write, we still need to update the current chunk producer._currentChunkMemoryUpdated = false; return(producer._flusher.FlushAsync(producer._minResponseDataRateFeature.MinDataRate, bytesWritten, producer._outputAborter, token)); }
public Http1Connection(HttpConnectionContext context) : base(context) { _context = context; _parser = ServiceContext.HttpParser; _keepAliveTicks = ServerOptions.Limits.KeepAliveTimeout.Ticks; _requestHeadersTimeoutTicks = ServerOptions.Limits.RequestHeadersTimeout.Ticks; _http1Output = new Http1OutputProducer( _context.Transport.Output, _context.ConnectionId, _context.ConnectionContext, _context.ServiceContext.Log, _context.TimeoutControl, this, _context.MemoryPool); Input = _context.Transport.Input; Output = _http1Output; MemoryPool = _context.MemoryPool; }
public Http1Connection(HttpConnectionContext context) { Initialize(context); _context = context; _parser = ServiceContext.HttpParser; _keepAliveTicks = ServerOptions.Limits.KeepAliveTimeout.Ticks; _requestHeadersTimeoutTicks = ServerOptions.Limits.RequestHeadersTimeout.Ticks; _http1Output = new Http1OutputProducer( _context.Transport.Output, _context.ConnectionId, _context.ConnectionContext, _context.MemoryPool, _context.ServiceContext.Log, _context.TimeoutControl, minResponseDataRateFeature: this, outputAborter: this); Input = _context.Transport.Input; Output = _http1Output; MemoryPool = _context.MemoryPool; }