예제 #1
0
        public async ValueTask DisposeAsync()
        {
            if (Interlocked.Exchange(ref _isDisposed, 1) != 0)
            {
                return;
            }

            _eventRegister.Register(new ReaderDisposed(_correlationId, this));
            await _channel.DisposeAsync();
        }
예제 #2
0
        public async ValueTask DisposeAsync()
        {
            if (Interlocked.Exchange(ref _isDisposed, 1) != 0)
            {
                return;
            }

            _eventRegister.Register(new ReaderDisposed(_correlationId, this));
            await _channel.ClosedByClient(CancellationToken.None).ConfigureAwait(false);

            await _channel.DisposeAsync().ConfigureAwait(false);
        }
예제 #3
0
        internal async ValueTask SetChannel(IReaderChannel channel)
        {
            if (_isDisposed != 0)
            {
                await channel.DisposeAsync().ConfigureAwait(false);

                return;
            }

            var oldChannel = _channel;

            _channel = channel;

            if (oldChannel != null)
            {
                await oldChannel.DisposeAsync().ConfigureAwait(false);
            }
        }