Skip to content

Commit

Permalink
Clang format.
Browse files Browse the repository at this point in the history
  • Loading branch information
Capstan committed Aug 1, 2018
1 parent ab8b628 commit 9ddb234
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
20 changes: 11 additions & 9 deletions test/cpp/util/cli_credentials.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,17 @@ DEFINE_string(
ssl_target, "",
"If not empty, treat the server host name as this for ssl/tls certificate "
"validation.");
DEFINE_string(
channel_creds_type, "",
"The channel creds type: insecure, ssl, or alts.");
DEFINE_string(channel_creds_type, "",
"The channel creds type: insecure, ssl, or alts.");

namespace grpc {
namespace testing {

grpc::string CliCredentials::GetDefaultChannelCredsType() const {
// Compatibility logic for --enable_ssl.
if (FLAGS_enable_ssl) {
fprintf(stderr, "warning: --enable_ssl is deprecated. Use "
fprintf(stderr,
"warning: --enable_ssl is deprecated. Use "
"--channel_creds_type=ssl.\n");
return "ssl";
}
Expand All @@ -53,7 +53,7 @@ grpc::string CliCredentials::GetDefaultChannelCredsType() const {
}

std::shared_ptr<grpc::ChannelCredentials>
CliCredentials::GetChannelCredentials() const {
CliCredentials::GetChannelCredentials() const {
if (FLAGS_channel_creds_type.compare("insecure") == 0) {
return grpc::InsecureChannelCredentials();
} else if (FLAGS_channel_creds_type.compare("ssl") == 0) {
Expand Down Expand Up @@ -86,7 +86,8 @@ std::shared_ptr<grpc::ChannelCredentials> CliCredentials::GetCredentials()
if (FLAGS_channel_creds_type.empty()) {
FLAGS_channel_creds_type = GetDefaultChannelCredsType();
} else if (FLAGS_enable_ssl && FLAGS_channel_creds_type.compare("ssl") != 0) {
fprintf(stderr, "warning: ignoring --enable_ssl because "
fprintf(stderr,
"warning: ignoring --enable_ssl because "
"--channel_creds_type already set to %s.\n",
FLAGS_channel_creds_type.c_str());
}
Expand All @@ -112,8 +113,9 @@ std::shared_ptr<grpc::ChannelCredentials> CliCredentials::GetCredentials()
}
// Composite any call-type credentials on top of the base channel.
std::shared_ptr<grpc::CallCredentials> call_creds = GetCallCredentials();
return (channel_creds == nullptr || call_creds == nullptr) ? channel_creds :
grpc::CompositeChannelCredentials(channel_creds, call_creds);
return (channel_creds == nullptr || call_creds == nullptr)
? channel_creds
: grpc::CompositeChannelCredentials(channel_creds, call_creds);
}

const grpc::string CliCredentials::GetCredentialUsage() const {
Expand All @@ -128,7 +130,7 @@ const grpc::string CliCredentials::GetCredentialUsage() const {

const grpc::string CliCredentials::GetSslTargetNameOverride() const {
bool use_ssl = FLAGS_channel_creds_type.compare("ssl") == 0 ||
(FLAGS_access_token.empty() && FLAGS_use_auth);
(FLAGS_access_token.empty() && FLAGS_use_auth);
return use_ssl ? FLAGS_ssl_target : "";
}

Expand Down
1 change: 1 addition & 0 deletions test/cpp/util/cli_credentials.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class CliCredentials {
std::shared_ptr<grpc::ChannelCredentials> GetCredentials() const;
virtual const grpc::string GetCredentialUsage() const;
virtual const grpc::string GetSslTargetNameOverride() const;

protected:
// Returns the appropriate channel_creds_type value for the set of legacy
// flag arguments.
Expand Down
4 changes: 2 additions & 2 deletions test/cpp/util/grpc_tool_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ const int kServerDefaultResponseStreamsToSend = 3;
class TestCliCredentials final : public grpc::testing::CliCredentials {
public:
TestCliCredentials(bool secure = false) : secure_(secure) {}
std::shared_ptr<grpc::ChannelCredentials> GetChannelCredentials() const
override {
std::shared_ptr<grpc::ChannelCredentials> GetChannelCredentials()
const override {
if (!secure_) {
return InsecureChannelCredentials();
}
Expand Down

0 comments on commit 9ddb234

Please sign in to comment.