private async Task ProduceEndAwaited() { ProduceStart(appCompleted: true); // Force flush await SocketOutput.WriteAsync(_emptyData); await WriteSuffix(); }
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); } }
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)); } }
private Task WriteChunkedResponseSuffix() { return(SocketOutput.WriteAsync(_endChunkedResponseBytes)); }
private Task WriteChunkedAsync(ArraySegment <byte> data, CancellationToken cancellationToken) { return(SocketOutput.WriteAsync(data, chunk: true, cancellationToken: cancellationToken)); }
public async Task FlushAsync(CancellationToken cancellationToken) { await ProduceStartAndFireOnStarting(); await SocketOutput.WriteAsync(_emptyData, cancellationToken : cancellationToken); }