grpc_channel from
Inheritance: Grpc.Core.Internal.SafeHandleZeroIsInvalid
Example #1
0
        public static CallSafeHandle Create(ChannelSafeHandle channel, CompletionRegistry registry, CompletionQueueSafeHandle cq, string method, string host, Timespec deadline)
        {
            var result = grpcsharp_channel_create_call(channel, cq, method, host, deadline);

            result.SetCompletionRegistry(registry);
            return(result);
        }
Example #2
0
 /// <summary>
 /// Creates a channel.
 /// </summary>
 public Channel(string target, Credentials credentials = null, ChannelArgs channelArgs = null)
 {
     using (ChannelArgsSafeHandle nativeChannelArgs = CreateNativeChannelArgs(channelArgs))
     {
         if (credentials != null)
         {
             using (CredentialsSafeHandle nativeCredentials = credentials.ToNativeCredentials())
             {
                 this.handle = ChannelSafeHandle.CreateSecure(nativeCredentials, target, nativeChannelArgs);
             }
         }
         else
         {
             this.handle = ChannelSafeHandle.Create(target, nativeChannelArgs);
         }
     }
     this.target = GetOverridenTarget(target, channelArgs);
 }
Example #3
0
 /// <summary>
 /// Creates a channel that connects to a specific host.
 /// Port will default to 80 for an unsecure channel and to 443 a secure channel.
 /// </summary>
 /// <param name="host">The DNS name of IP address of the host.</param>
 /// <param name="credentials">Optional credentials to create a secure channel.</param>
 /// <param name="options">Channel options.</param>
 public Channel(string host, Credentials credentials = null, IEnumerable<ChannelOption> options = null)
 {
     using (ChannelArgsSafeHandle nativeChannelArgs = ChannelOptions.CreateChannelArgs(options))
     {
         if (credentials != null)
         {
             using (CredentialsSafeHandle nativeCredentials = credentials.ToNativeCredentials())
             {
                 this.handle = ChannelSafeHandle.CreateSecure(nativeCredentials, host, nativeChannelArgs);
             }
         }
         else
         {
             this.handle = ChannelSafeHandle.Create(host, nativeChannelArgs);
         }
     }
     this.target = GetOverridenTarget(host, options);
 }
Example #4
0
        /// <summary>
        /// Creates a channel that connects to a specific host.
        /// Port will default to 80 for an unsecure channel and to 443 for a secure channel.
        /// </summary>
        /// <param name="target">Target of the channel.</param>
        /// <param name="credentials">Credentials to secure the channel.</param>
        /// <param name="options">Channel options.</param>
        public Channel(string target, Credentials credentials, IEnumerable<ChannelOption> options = null)
        {
            this.target = Preconditions.CheckNotNull(target, "target");
            this.environment = GrpcEnvironment.AddRef();
            this.options = options != null ? new List<ChannelOption>(options) : new List<ChannelOption>();

            EnsureUserAgentChannelOption(this.options);
            using (CredentialsSafeHandle nativeCredentials = credentials.ToNativeCredentials())
            using (ChannelArgsSafeHandle nativeChannelArgs = ChannelOptions.CreateChannelArgs(this.options))
            {
                if (nativeCredentials != null)
                {
                    this.handle = ChannelSafeHandle.CreateSecure(nativeCredentials, target, nativeChannelArgs);
                }
                else
                {
                    this.handle = ChannelSafeHandle.CreateInsecure(target, nativeChannelArgs);
                }
            }
        }
Example #5
0
        /// <summary>
        /// Creates a channel that connects to a specific host.
        /// Port will default to 80 for an unsecure channel and to 443 a secure channel.
        /// </summary>
        /// <param name="host">The DNS name of IP address of the host.</param>
        /// <param name="credentials">Credentials to secure the channel.</param>
        /// <param name="options">Channel options.</param>
        public Channel(string host, Credentials credentials, IEnumerable<ChannelOption> options = null)
        {
            this.environment = GrpcEnvironment.GetInstance();
            this.options = options != null ? new List<ChannelOption>(options) : new List<ChannelOption>();

            EnsureUserAgentChannelOption(this.options);
            using (CredentialsSafeHandle nativeCredentials = credentials.ToNativeCredentials())
            using (ChannelArgsSafeHandle nativeChannelArgs = ChannelOptions.CreateChannelArgs(this.options))
            {
                if (nativeCredentials != null)
                {
                    this.handle = ChannelSafeHandle.CreateSecure(nativeCredentials, host, nativeChannelArgs);
                }
                else
                {
                    this.handle = ChannelSafeHandle.CreateInsecure(host, nativeChannelArgs);
                }
            }
            this.target = GetOverridenTarget(host, this.options);
        }
Example #6
0
 public static CallSafeHandle Create(ChannelSafeHandle channel, CompletionQueueSafeHandle cq, string method, string host, Timespec deadline)
 {
     return grpcsharp_channel_create_call(channel, cq, method, host, deadline);
 }
Example #7
0
 static extern void grpcsharp_channel_watch_connectivity_state(ChannelSafeHandle channel, ChannelState lastObservedState,
     Timespec deadline, CompletionQueueSafeHandle cq, BatchContextSafeHandle ctx);
Example #8
0
 static extern CallSafeHandle grpcsharp_channel_create_call(ChannelSafeHandle channel, CallSafeHandle parentCall, ContextPropagationFlags propagationMask, CompletionQueueSafeHandle cq, string method, string host, Timespec deadline);
Example #9
0
 internal static extern void grpcsharp_channel_watch_connectivity_state(ChannelSafeHandle channel, ChannelState lastObservedState,
                                                                        Timespec deadline, CompletionQueueSafeHandle cq, BatchContextSafeHandle ctx);
Example #10
0
 internal static extern CallSafeHandle grpcsharp_channel_create_call(ChannelSafeHandle channel, CallSafeHandle parentCall, ContextPropagationFlags propagationMask, CompletionQueueSafeHandle cq, string method, string host, Timespec deadline);
Example #11
0
 void IPlatformInvocation.grpcsharp_channel_watch_connectivity_state(ChannelSafeHandle channel,
     ChannelState lastObservedState, Timespec deadline, CompletionQueueSafeHandle cq, BatchContextSafeHandle ctx)
 {
     grpcsharp_channel_watch_connectivity_state(channel, lastObservedState, deadline, cq, ctx);
 }
Example #12
0
 static extern CallSafeHandle grpcsharp_channel_create_call(ChannelSafeHandle channel, CompletionQueueSafeHandle cq, string method, string host, Timespec deadline);
        /// <summary>
        /// Creates a channel that connects to a specific host.
        /// Port will default to 80 for an unsecure channel and to 443 for a secure channel.
        /// </summary>
        /// <param name="target">Target of the channel.</param>
        /// <param name="credentials">Credentials to secure the channel.</param>
        /// <param name="options">Channel options.</param>
        public Channel(string target, ChannelCredentials credentials, IEnumerable<ChannelOption> options)
        {
            this.target = GrpcPreconditions.CheckNotNull(target, "target");
            this.options = CreateOptionsDictionary(options);
            EnsureUserAgentChannelOption(this.options);
            this.environment = GrpcEnvironment.AddRef();

            this.completionQueue = this.environment.PickCompletionQueue();
            using (var nativeCredentials = credentials.ToNativeCredentials())
            using (var nativeChannelArgs = ChannelOptions.CreateChannelArgs(this.options.Values))
            {
                if (nativeCredentials != null)
                {
                    this.handle = ChannelSafeHandle.CreateSecure(nativeCredentials, target, nativeChannelArgs);
                }
                else
                {
                    this.handle = ChannelSafeHandle.CreateInsecure(target, nativeChannelArgs);
                }
            }
            GrpcEnvironment.RegisterChannel(this);
        }
Example #14
0
 public static CallSafeHandle Create(ChannelSafeHandle channel, CompletionQueueSafeHandle cq, string method, string host, Timespec deadline)
 {
     return(grpcsharp_channel_create_call(channel, cq, method, host, deadline));
 }
Example #15
0
 CallSafeHandle IPlatformInvocation.grpcsharp_channel_create_call(ChannelSafeHandle channel,
     CallSafeHandle parentCall, ContextPropagationFlags propagationMask, CompletionQueueSafeHandle cq,
     string method, string host, Timespec deadline)
 {
     return grpcsharp_channel_create_call(channel, parentCall, propagationMask, cq, method, host, deadline);
 }
Example #16
0
 ChannelState IPlatformInvocation.grpcsharp_channel_check_connectivity_state(ChannelSafeHandle channel, int tryToConnect)
 {
     return grpcsharp_channel_check_connectivity_state(channel, tryToConnect);
 }
Example #17
0
 static extern CallSafeHandle grpcsharp_channel_create_call(ChannelSafeHandle channel, CompletionQueueSafeHandle cq, string method, string host, Timespec deadline);
Example #18
0
 CStringSafeHandle IPlatformInvocation.grpcsharp_channel_get_target(ChannelSafeHandle call)
 {
     return grpcsharp_channel_get_target(call);
 }
Example #19
0
 CallSafeHandle IPlatformInvocation.grpcsharp_channel_create_call(ChannelSafeHandle channel,
                                                                  CallSafeHandle parentCall, ContextPropagationFlags propagationMask, CompletionQueueSafeHandle cq,
                                                                  string method, string host, Timespec deadline)
 {
     return(grpcsharp_channel_create_call(channel, parentCall, propagationMask, cq, method, host, deadline));
 }
Example #20
0
 internal static extern ChannelState grpcsharp_channel_check_connectivity_state(ChannelSafeHandle channel, int tryToConnect);
Example #21
0
 ChannelState IPlatformInvocation.grpcsharp_channel_check_connectivity_state(ChannelSafeHandle channel, int tryToConnect)
 {
     return(grpcsharp_channel_check_connectivity_state(channel, tryToConnect));
 }
Example #22
0
 internal static extern CStringSafeHandle grpcsharp_channel_get_target(ChannelSafeHandle call);
Example #23
0
 void IPlatformInvocation.grpcsharp_channel_watch_connectivity_state(ChannelSafeHandle channel,
                                                                     ChannelState lastObservedState, Timespec deadline, CompletionQueueSafeHandle cq, BatchContextSafeHandle ctx)
 {
     grpcsharp_channel_watch_connectivity_state(channel, lastObservedState, deadline, cq, ctx);
 }
Example #24
0
 static extern ChannelState grpcsharp_channel_check_connectivity_state(ChannelSafeHandle channel, int tryToConnect);
Example #25
0
 CStringSafeHandle IPlatformInvocation.grpcsharp_channel_get_target(ChannelSafeHandle call)
 {
     return(grpcsharp_channel_get_target(call));
 }
Example #26
0
 static extern CStringSafeHandle grpcsharp_channel_get_target(ChannelSafeHandle call);
Example #27
0
 public static CallSafeHandle Create(ChannelSafeHandle channel, CompletionRegistry registry, CompletionQueueSafeHandle cq, string method, string host, Timespec deadline)
 {
     var result = grpcsharp_channel_create_call(channel, cq, method, host, deadline);
     result.SetCompletionRegistry(registry);
     return result;
 }