diff options
author | 2015-12-16 13:04:37 -0800 | |
---|---|---|
committer | 2015-12-16 13:04:37 -0800 | |
commit | afe3974bce8e46b9d137b5578e2addf2c459726f (patch) | |
tree | 7c8d51465c5899e366383284bcf99f9794a12de7 /src/ruby/lib | |
parent | da61668122b63fc18d64231dede700139234bc75 (diff) |
Made insecure channel/stub explicit, in all layers
Diffstat (limited to 'src/ruby/lib')
-rw-r--r-- | src/ruby/lib/grpc/generic/client_stub.rb | 14 | ||||
-rw-r--r-- | src/ruby/lib/grpc/generic/service.rb | 6 |
2 files changed, 11 insertions, 9 deletions
diff --git a/src/ruby/lib/grpc/generic/client_stub.rb b/src/ruby/lib/grpc/generic/client_stub.rb index 13100a614c..32da7a2b0f 100644 --- a/src/ruby/lib/grpc/generic/client_stub.rb +++ b/src/ruby/lib/grpc/generic/client_stub.rb @@ -50,9 +50,8 @@ module GRPC return alt_chan end kw['grpc.primary_user_agent'] = "grpc-ruby/#{VERSION}" - return Core::Channel.new(host, kw) if creds.nil? - unless creds.is_a?(Core::ChannelCredentials) - fail(TypeError, '!ChannelCredentials') + unless creds.is_a?(Core::ChannelCredentials) || creds.is_a?(Symbol) + fail(TypeError, '!ChannelCredentials or Symbol') end Core::Channel.new(host, kw, creds) end @@ -68,7 +67,8 @@ module GRPC # Minimally, a stub is created with the just the host of the gRPC service # it wishes to access, e.g., # - # my_stub = ClientStub.new(example.host.com:50505) + # my_stub = ClientStub.new(example.host.com:50505, + # :this_channel_is_insecure) # # Any arbitrary keyword arguments are treated as channel arguments used to # configure the RPC connection to the host. @@ -86,14 +86,14 @@ module GRPC # # @param host [String] the host the stub connects to # @param q [Core::CompletionQueue] used to wait for events + # @param creds [Core::ChannelCredentials|Symbol] the channel credentials, or + # :this_channel_is_insecure # @param channel_override [Core::Channel] a pre-created channel # @param timeout [Number] the default timeout to use in requests - # @param creds [Core::ChannelCredentials] the channel credentials # @param kw [KeywordArgs]the channel arguments - def initialize(host, q, + def initialize(host, q, creds, channel_override: nil, timeout: nil, - creds: nil, propagate_mask: nil, **kw) fail(TypeError, '!CompletionQueue') unless q.is_a?(Core::CompletionQueue) diff --git a/src/ruby/lib/grpc/generic/service.rb b/src/ruby/lib/grpc/generic/service.rb index 80ff669cca..410e1add7d 100644 --- a/src/ruby/lib/grpc/generic/service.rb +++ b/src/ruby/lib/grpc/generic/service.rb @@ -160,10 +160,12 @@ module GRPC route_prefix = service_name Class.new(ClientStub) do # @param host [String] the host the stub connects to + # @param creds [Core::ChannelCredentials|Symbol] The channel + # credentials to use, or :this_channel_is_insecure otherwise # @param kw [KeywordArgs] the channel arguments, plus any optional # args for configuring the client's channel - def initialize(host, **kw) - super(host, Core::CompletionQueue.new, **kw) + def initialize(host, creds, **kw) + super(host, Core::CompletionQueue.new, creds, **kw) end # Used define_method to add a method for each rpc_desc. Each method |