/// <inheritdoc />
        protected override async Task <CallInvoker> CreateCallInvokerAsync(CancellationToken cancellationToken)
        {
            if (CallInvoker != null)
            {
                return(CallInvoker);
            }
            var endpoint       = Endpoint ?? GetDefaultEndpoint();
            var channelOptions = Settings.CreateChannelOptions().Concat(GetChannelOptions()).ToList();

            // Although *we* never allow the use of the channel pool, we can use the call invoker pool if and
            // only if the base class thinks it can use the channel pool - i.e. it's only using default credentials.
            if (base.CanUseChannelPool)
            {
                return(await CallInvokerPool.GetCallInvokerAsync(endpoint, channelOptions).ConfigureAwait(false));
            }
            else
            {
                var credentials = GetChannelCredentials();
                return(new GcpCallInvoker(endpoint.ToString(), credentials, channelOptions));
            }
        }
示例#2
0
        /// <inheritdoc />
        protected override CallInvoker CreateCallInvoker()
        {
            if (CallInvoker != null)
            {
                return(CallInvoker);
            }
            var endpoint       = Endpoint ?? GetDefaultEndpoint();
            var channelOptions = GetChannelOptions().MergedWith(Settings.CreateChannelOptions());

            // Although *we* never allow the use of the channel pool, we can use the call invoker pool if and
            // only if the base class thinks it can use the channel pool - i.e. it's only using default credentials.
            if (base.CanUseChannelPool)
            {
                return(CallInvokerPool.GetCallInvoker(endpoint, channelOptions));
            }
            else
            {
                var credentials = GetChannelCredentials();
                return(new GcpCallInvoker(endpoint.ToString(), credentials, GrpcCoreAdapter.Instance.ConvertOptions(channelOptions)));
            }
        }