示例#1
0
        public async ValueTask DisposeAsync()
        {
            if (_connection == null)
            {
                return;
            }

            await _writer.DisposeAsync().ConfigureAwait(false);

            _reader.Connection.Transport.Input.CancelPendingRead();

            await _readingTask.ConfigureAwait(false);

            await _reader.DisposeAsync().ConfigureAwait(false);

            foreach (var operation in _operations)
            {
                _operations.TryRemove(operation.Key, out _);

                // Cancel all pending operations
                operation.Value.TrySetCanceled();
            }

            await _connection.DisposeAsync().ConfigureAwait(false);
        }
示例#2
0
 public ValueTask DisposeAsync()
 {
     return(_protocol.DisposeAsync());
 }