Пример #1
0
#pragma warning restore

        private IReadOnlyList <AttestationSigner> GetSigners()
        {
            lock (_statelock)
            {
                if (_signers == null)
                {
                    _signers = _attestationClient.GetSigningCertificates().Value;
                }

                return(_signers);
            }
        }
        private IReadOnlyList <AttestationSigner> GetSigners(CancellationToken cancellationToken)
        {
            _statelock.Wait(cancellationToken);
            try
            {
                if (_signers == null)
                {
                    _signers = _attestationClient.GetSigningCertificates(cancellationToken).Value;
                }

                return(_signers);
            }
            finally
            {
                _statelock.Release();
            }
        }
Пример #3
0
        private async Task <IReadOnlyList <AttestationSigner> > GetSignersAsync(bool async, CancellationToken cancellationToken)
        {
            if (async)
            {
                await _statelock.WaitAsync(cancellationToken).ConfigureAwait(false);

                try
                {
                    if (_signers == null)
                    {
                        _signers = (await _attestationClient.GetSigningCertificatesAsync(cancellationToken).ConfigureAwait(false)).Value;
                    }

                    return(_signers);
                }
                finally
                {
                    _statelock.Release();
                }
            }
            else
            {
                _statelock.Wait(cancellationToken);
                try
                {
                    if (_signers == null)
                    {
                        _signers = _attestationClient.GetSigningCertificates(cancellationToken).Value;
                    }

                    return(_signers);
                }
                finally
                {
                    _statelock.Release();
                }
            }
        }