Merge branch 'benaadams/flush' into dev

This commit is contained in:
Cesar Blum Silveira 2017-01-23 09:36:29 -08:00
commit 2895447cbe
4 changed files with 15 additions and 6 deletions

View File

@ -71,6 +71,11 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Adapter.Internal
_inner.Flush(); _inner.Flush();
} }
public override Task FlushAsync(CancellationToken cancellationToken)
{
return _inner.FlushAsync(cancellationToken);
}
public override int Read(byte[] buffer, int offset, int count) public override int Read(byte[] buffer, int offset, int count)
{ {
int read = _inner.Read(buffer, offset, count); int read = _inner.Read(buffer, offset, count);

View File

@ -117,13 +117,12 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Adapter.Internal
public override void Flush() public override void Flush()
{ {
// No-op since writes are immediate. _output.Flush();
} }
public override Task FlushAsync(CancellationToken cancellationToken) public override Task FlushAsync(CancellationToken cancellationToken)
{ {
// No-op since writes are immediate. return _output.FlushAsync(cancellationToken);
return TaskCache.CompletedTask;
} }
private ValueTask<int> ReadAsync(ArraySegment<byte> buffer) private ValueTask<int> ReadAsync(ArraySegment<byte> buffer)

View File

@ -114,14 +114,14 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Adapter.Internal
end.Block.Pool.Return(end.Block); end.Block.Pool.Return(end.Block);
} }
// Flush no-ops. We rely on connection filter streams to auto-flush.
public void Flush() public void Flush()
{ {
_outputStream.Flush();
} }
public Task FlushAsync(CancellationToken cancellationToken) public Task FlushAsync(CancellationToken cancellationToken)
{ {
return TaskCache.CompletedTask; return _outputStream.FlushAsync(cancellationToken);
} }
} }
} }

View File

@ -186,7 +186,12 @@ namespace Microsoft.AspNetCore.Server.KestrelTests
public override void Flush() public override void Flush()
{ {
// No-op _innerStream.Flush();
}
public override Task FlushAsync(CancellationToken cancellationToken)
{
return _innerStream.FlushAsync(cancellationToken);
} }
public override int Read(byte[] buffer, int offset, int count) public override int Read(byte[] buffer, int offset, int count)