diff options
author | Alistair Veitch <aveitch@google.com> | 2015-07-26 15:24:41 -0700 |
---|---|---|
committer | Alistair Veitch <aveitch@google.com> | 2015-07-26 15:24:41 -0700 |
commit | b4cbc1e2f72b18da3c84130c5bf7b28e344fba8f (patch) | |
tree | 5564c6754f30570bb59c6e62c2ddda405a51296b /src/cpp/client/create_channel.cc | |
parent | af5002f9ae647f8d82ec3b1cdaef4438cd6d2ad0 (diff) | |
parent | 5c575dd6e4b01cd68cca5d1917b58023dcf4ca0f (diff) |
post-merge
Diffstat (limited to 'src/cpp/client/create_channel.cc')
-rw-r--r-- | src/cpp/client/create_channel.cc | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/cpp/client/create_channel.cc b/src/cpp/client/create_channel.cc index 510af2bb00..62f179d361 100644 --- a/src/cpp/client/create_channel.cc +++ b/src/cpp/client/create_channel.cc @@ -32,9 +32,11 @@ */ #include <memory> +#include <sstream> #include "src/cpp/client/channel.h" #include <grpc++/channel_interface.h> +#include <grpc++/channel_arguments.h> #include <grpc++/create_channel.h> namespace grpc { @@ -43,8 +45,13 @@ class ChannelArguments; std::shared_ptr<ChannelInterface> CreateChannel( const grpc::string& target, const std::shared_ptr<Credentials>& creds, const ChannelArguments& args) { - return creds ? creds->CreateChannel(target, args) + ChannelArguments cp_args = args; + std::ostringstream user_agent_prefix; + user_agent_prefix << "grpc-c++/" << grpc_version_string(); + cp_args.SetString(GRPC_ARG_PRIMARY_USER_AGENT_STRING, + user_agent_prefix.str()); + return creds ? creds->CreateChannel(target, cp_args) : std::shared_ptr<ChannelInterface>( - new Channel(target, grpc_lame_client_channel_create())); + new Channel(target, grpc_lame_client_channel_create(NULL))); } } // namespace grpc |