Exemplo n.º 1
0
        private async Task ProduceEndAwaited()
        {
            ProduceStart(appCompleted: true);

            // Force flush
            await SocketOutput.WriteAsync(_emptyData);

            await WriteSuffix();
        }
Exemplo n.º 2
0
        public async Task WriteAsyncAwaited(ArraySegment <byte> data, CancellationToken cancellationToken)
        {
            await ProduceStartAndFireOnStarting();

            if (_autoChunk)
            {
                if (data.Count == 0)
                {
                    return;
                }
                await WriteChunkedAsync(data, cancellationToken);
            }
            else
            {
                await SocketOutput.WriteAsync(data, cancellationToken : cancellationToken);
            }
        }
Exemplo n.º 3
0
        public Task WriteAsync(ArraySegment <byte> data, CancellationToken cancellationToken)
        {
            if (!_responseStarted)
            {
                return(WriteAsyncAwaited(data, cancellationToken));
            }

            if (_autoChunk)
            {
                if (data.Count == 0)
                {
                    return(TaskUtilities.CompletedTask);
                }
                return(WriteChunkedAsync(data, cancellationToken));
            }
            else
            {
                return(SocketOutput.WriteAsync(data, cancellationToken: cancellationToken));
            }
        }
Exemplo n.º 4
0
 private Task WriteChunkedResponseSuffix()
 {
     return(SocketOutput.WriteAsync(_endChunkedResponseBytes));
 }
Exemplo n.º 5
0
 private Task WriteChunkedAsync(ArraySegment <byte> data, CancellationToken cancellationToken)
 {
     return(SocketOutput.WriteAsync(data, chunk: true, cancellationToken: cancellationToken));
 }
Exemplo n.º 6
0
        public async Task FlushAsync(CancellationToken cancellationToken)
        {
            await ProduceStartAndFireOnStarting();

            await SocketOutput.WriteAsync(_emptyData, cancellationToken : cancellationToken);
        }