From dafcce980d847e3a90cb7aa31641c464bbc5809a Mon Sep 17 00:00:00 2001 From: yang-g <yangg@google.com> Date: Thu, 27 Aug 2015 11:34:05 -0700 Subject: [PATCH] channel creation API change --- include/grpc++/create_channel.h | 6 ++++++ src/cpp/client/create_channel.cc | 8 +++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/include/grpc++/create_channel.h b/include/grpc++/create_channel.h index 0e559ac53e..916f3b0b97 100644 --- a/include/grpc++/create_channel.h +++ b/include/grpc++/create_channel.h @@ -44,6 +44,12 @@ namespace grpc { // If creds does not hold an object or is invalid, a lame channel is returned. std::shared_ptr<Channel> CreateChannel( + const grpc::string& target, const std::shared_ptr<Credentials>& creds); + +// For advanced use and testing ONLY. Override default channel arguments only +// if necessary. +// If creds does not hold an object or is invalid, a lame channel is returned. +std::shared_ptr<Channel> CreateCustomChannel( const grpc::string& target, const std::shared_ptr<Credentials>& creds, const ChannelArguments& args); diff --git a/src/cpp/client/create_channel.cc b/src/cpp/client/create_channel.cc index 8c571cbbaa..8d2f1bf37a 100644 --- a/src/cpp/client/create_channel.cc +++ b/src/cpp/client/create_channel.cc @@ -43,7 +43,12 @@ namespace grpc { class ChannelArguments; -std::shared_ptr<Channel> CreateChannel( +std::shared_ptr<Channel> CreateCustomChannel( + const grpc::string& target, const std::shared_ptr<Credentials>& creds) { + return CreateCustomChannel(target, creds, ChannelArguments()); +} + +std::shared_ptr<Channel> CreateCustomChannel( const grpc::string& target, const std::shared_ptr<Credentials>& creds, const ChannelArguments& args) { ChannelArguments cp_args = args; @@ -57,4 +62,5 @@ std::shared_ptr<Channel> CreateChannel( NULL, GRPC_STATUS_INVALID_ARGUMENT, "Invalid credentials.")); } + } // namespace grpc -- GitLab