示例#1
0
        public override async Task CloseAsync(CancellationToken cancellation)
        {
            if (_isClosed)
            {
                return;
            }

            _isClosed = true;
            _deflate.Close();
            _inner.Write(_BFINAL, 0, 1);
            await _inner.CloseAsync(cancellation).ConfigureAwait(false);
        }
        public override Task CloseAsync(CancellationToken cancellation)
        {
            if (_isClosed)
            {
                return(Task.FromResult <object>(null));
            }

            _isClosed = true;
            _deflate.Close();
            _inner.Write(_BFINAL, 0, 1);

            return(_inner.CloseAsync(cancellation));
        }
        public override async Task CloseAsync()
        {
            if (_isClosed)
            {
                return;
            }

            _isClosed = true;
            await _deflate.FlushAsync().ConfigureAwait(false);

            SafeEnd.Dispose(_deflate); // TODO DeflateStream cant async flush buffer so this will cause sync Write call and blocks one thread from pool
            await _inner.WriteAsync(BFINAL, 0, 1).ConfigureAwait(false);

            await _inner.CloseAsync().ConfigureAwait(false);
        }