Merge pull request #4226 from nicolasnoble/format-0_12

Clang format.
pull/4277/head
Craig Tiller 9 years ago
commit 9d8d97ac3d
  1. 2
      include/grpc++/alarm.h
  2. 8
      include/grpc++/security/credentials.h
  3. 14
      src/core/channel/client_uchannel.c
  4. 4
      src/core/security/client_auth_filter.c
  5. 1
      src/core/security/credentials.c
  6. 13
      src/core/security/credentials.h
  7. 3
      src/core/security/google_default_credentials.c
  8. 6
      src/core/security/security_connector.c
  9. 6
      src/core/security/security_context.c
  10. 3
      src/core/security/server_auth_filter.c
  11. 3
      src/core/security/server_secure_chttp2.c
  12. 1
      src/core/surface/byte_buffer_reader.c
  13. 1
      src/core/surface/call_test_only.h
  14. 4
      src/cpp/client/insecure_credentials.cc
  15. 1
      src/cpp/client/secure_credentials.h
  16. 8
      src/cpp/common/alarm.cc
  17. 9
      test/core/client_config/lb_policies_test.c
  18. 8
      test/core/network_benchmarks/low_level_ping_pong.c
  19. 17
      test/core/security/credentials_test.c
  20. 3
      test/core/security/oauth2_utils.c
  21. 4
      test/core/surface/byte_buffer_reader_test.c
  22. 46
      test/cpp/qps/client.h

@ -43,7 +43,7 @@
namespace grpc {
/// A thin wrapper around \a grpc_alarm (see / \a / src/core/surface/alarm.h).
class Alarm: public GrpcLibrary {
class Alarm : public GrpcLibrary {
public:
/// Create a completion queue alarm instance associated to \a cq.
///

@ -187,9 +187,8 @@ std::shared_ptr<CallCredentials> GoogleIAMCredentials(
/// Combines a channel credentials and a call credentials into a composite
/// channel credentials.
std::shared_ptr<ChannelCredentials> CompositeChannelCredentials(
const std::shared_ptr<ChannelCredentials>& channel_creds,
const std::shared_ptr<CallCredentials>& call_creds);
const std::shared_ptr<ChannelCredentials>& channel_creds,
const std::shared_ptr<CallCredentials>& call_creds);
/// Combines two call credentials objects into a composite call credentials.
std::shared_ptr<CallCredentials> CompositeCallCredentials(
@ -217,8 +216,7 @@ class MetadataCredentialsPlugin {
// The channel_auth_context contains (among other things), the identity of
// the server.
virtual Status GetMetadata(
grpc::string_ref service_url,
grpc::string_ref method_name,
grpc::string_ref service_url, grpc::string_ref method_name,
const AuthContext& channel_auth_context,
std::multimap<grpc::string, grpc::string>* metadata) = 0;
};

@ -172,7 +172,7 @@ static void monitor_subchannel(grpc_exec_ctx *exec_ctx, void *arg,
}
static void started_call_locked(grpc_exec_ctx *exec_ctx, void *arg,
int iomgr_success) {
int iomgr_success) {
call_data *calld = arg;
grpc_transport_stream_op op;
int have_waiting;
@ -466,15 +466,9 @@ static void cuc_destroy_channel_elem(grpc_exec_ctx *exec_ctx,
}
const grpc_channel_filter grpc_client_uchannel_filter = {
cuc_start_transport_stream_op,
cuc_start_transport_op,
sizeof(call_data),
cuc_init_call_elem,
cuc_destroy_call_elem,
sizeof(channel_data),
cuc_init_channel_elem,
cuc_destroy_channel_elem,
cuc_get_peer,
cuc_start_transport_stream_op, cuc_start_transport_op, sizeof(call_data),
cuc_init_call_elem, cuc_destroy_call_elem, sizeof(channel_data),
cuc_init_channel_elem, cuc_destroy_channel_elem, cuc_get_peer,
"client-uchannel",
};

@ -152,8 +152,8 @@ void build_auth_metadata_context(grpc_security_connector *sc,
grpc_mdstr_as_c_string(calld->host), service);
calld->auth_md_context.service_url = service_url;
calld->auth_md_context.method_name = method_name;
calld->auth_md_context.channel_auth_context = GRPC_AUTH_CONTEXT_REF(
sc->auth_context, "grpc_auth_metadata_context");
calld->auth_md_context.channel_auth_context =
GRPC_AUTH_CONTEXT_REF(sc->auth_context, "grpc_auth_metadata_context");
gpr_free(service);
}

@ -1272,4 +1272,3 @@ grpc_channel_credentials *grpc_composite_channel_credentials_create(
c->call_creds = grpc_call_credentials_ref(call_creds);
return &c->base;
}

@ -174,19 +174,18 @@ struct grpc_call_credentials {
grpc_call_credentials *grpc_call_credentials_ref(grpc_call_credentials *creds);
void grpc_call_credentials_unref(grpc_call_credentials *creds);
void grpc_call_credentials_get_request_metadata(grpc_exec_ctx *exec_ctx,
grpc_call_credentials *creds,
grpc_pollset *pollset,
grpc_auth_metadata_context context,
grpc_credentials_metadata_cb cb,
void *user_data);
void grpc_call_credentials_get_request_metadata(
grpc_exec_ctx *exec_ctx, grpc_call_credentials *creds,
grpc_pollset *pollset, grpc_auth_metadata_context context,
grpc_credentials_metadata_cb cb, void *user_data);
typedef struct {
grpc_call_credentials **creds_array;
size_t num_creds;
} grpc_call_credentials_array;
const grpc_call_credentials_array *grpc_composite_call_credentials_get_credentials(
const grpc_call_credentials_array *
grpc_composite_call_credentials_get_credentials(
grpc_call_credentials *composite_creds);
/* Returns creds if creds is of the specified type or the inner creds of the

@ -214,7 +214,8 @@ grpc_channel_credentials *grpc_google_default_credentials_create(void) {
end:
if (result == NULL) {
if (call_creds != NULL) {
/* Blend with default ssl credentials and add a global reference so that it
/* Blend with default ssl credentials and add a global reference so that
it
can be cached and re-served. */
grpc_channel_credentials *ssl_creds =
grpc_ssl_credentials_create(NULL, NULL, NULL);

@ -571,9 +571,9 @@ size_t grpc_get_default_ssl_roots(const unsigned char **pem_root_certs) {
}
grpc_security_status grpc_ssl_channel_security_connector_create(
grpc_call_credentials *request_metadata_creds, const grpc_ssl_config *config,
const char *target_name, const char *overridden_target_name,
grpc_channel_security_connector **sc) {
grpc_call_credentials *request_metadata_creds,
const grpc_ssl_config *config, const char *target_name,
const char *overridden_target_name, grpc_channel_security_connector **sc) {
size_t num_alpn_protocols = grpc_chttp2_num_alpn_versions();
const unsigned char **alpn_protocol_strings =
gpr_malloc(sizeof(const char *) * num_alpn_protocols);

@ -320,8 +320,7 @@ grpc_arg grpc_auth_context_to_arg(grpc_auth_context *p) {
return arg;
}
grpc_auth_context *grpc_auth_context_from_arg(
const grpc_arg *arg) {
grpc_auth_context *grpc_auth_context_from_arg(const grpc_arg *arg) {
if (strcmp(arg->key, GRPC_AUTH_CONTEXT_ARG) != 0) return NULL;
if (arg->type != GRPC_ARG_POINTER) {
gpr_log(GPR_ERROR, "Invalid type %d for arg %s", arg->type,
@ -336,8 +335,7 @@ grpc_auth_context *grpc_find_auth_context_in_args(
size_t i;
if (args == NULL) return NULL;
for (i = 0; i < args->num_args; i++) {
grpc_auth_context *p =
grpc_auth_context_from_arg(&args->args[i]);
grpc_auth_context *p = grpc_auth_context_from_arg(&args->args[i]);
if (p != NULL) return p;
}
return NULL;

@ -220,8 +220,7 @@ static void init_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
initial_op->context[GRPC_CONTEXT_SECURITY].value);
}
server_ctx = grpc_server_security_context_create();
server_ctx->auth_context =
grpc_auth_context_create(chand->auth_context);
server_ctx->auth_context = grpc_auth_context_create(chand->auth_context);
server_ctx->auth_context->pollset = initial_op->bind_pollset;
initial_op->context[GRPC_CONTEXT_SECURITY].value = server_ctx;
initial_op->context[GRPC_CONTEXT_SECURITY].destroy =

@ -94,8 +94,7 @@ static void setup_transport(grpc_exec_ctx *exec_ctx, void *statep,
grpc_channel_args *args_copy;
grpc_arg args_to_add[2];
args_to_add[0] = grpc_server_credentials_to_arg(state->creds);
args_to_add[1] =
grpc_auth_context_to_arg(state->sc->auth_context);
args_to_add[1] = grpc_auth_context_to_arg(state->sc->auth_context);
args_copy = grpc_channel_args_copy_and_add(
grpc_server_get_channel_args(state->server), args_to_add,
GPR_ARRAY_SIZE(args_to_add));

@ -121,4 +121,3 @@ gpr_slice grpc_byte_buffer_reader_readall(grpc_byte_buffer_reader *reader) {
}
return out_slice;
}

@ -57,7 +57,6 @@ gpr_uint32 grpc_call_test_only_get_message_flags(grpc_call *call);
* To be indexed by grpc_compression_algorithm enum values. */
gpr_uint32 grpc_call_test_only_get_encodings_accepted_by_peer(grpc_call *call);
#ifdef __cplusplus
}
#endif

@ -54,7 +54,9 @@ class InsecureChannelCredentialsImpl GRPC_FINAL : public ChannelCredentials {
grpc_insecure_channel_create(target.c_str(), &channel_args, nullptr));
}
SecureChannelCredentials* AsSecureCredentials() GRPC_OVERRIDE { return nullptr; }
SecureChannelCredentials* AsSecureCredentials() GRPC_OVERRIDE {
return nullptr;
}
};
} // namespace

@ -76,7 +76,6 @@ class SecureCallCredentials GRPC_FINAL : public CallCredentials {
grpc_call_credentials* const c_creds_;
};
class MetadataCredentialsPluginWrapper GRPC_FINAL {
public:
static void Destroy(void* wrapper);

@ -38,12 +38,8 @@ namespace grpc {
Alarm::Alarm(CompletionQueue* cq, gpr_timespec deadline, void* tag)
: alarm_(grpc_alarm_create(cq->cq(), deadline, tag)) {}
Alarm::~Alarm() {
grpc_alarm_destroy(alarm_);
}
Alarm::~Alarm() { grpc_alarm_destroy(alarm_); }
void Alarm::Cancel() {
grpc_alarm_cancel(alarm_);
}
void Alarm::Cancel() { grpc_alarm_cancel(alarm_); }
} // namespace grpc

@ -286,10 +286,12 @@ int *perform_request(servers_fixture *f, grpc_channel *client,
op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_STATUS_ON_CLIENT;
op->data.recv_status_on_client.trailing_metadata = &rdata->trailing_metadata_recv;
op->data.recv_status_on_client.trailing_metadata =
&rdata->trailing_metadata_recv;
op->data.recv_status_on_client.status = &rdata->status;
op->data.recv_status_on_client.status_details = &rdata->details;
op->data.recv_status_on_client.status_details_capacity = &rdata->details_capacity;
op->data.recv_status_on_client.status_details_capacity =
&rdata->details_capacity;
op->flags = 0;
op->reserved = NULL;
op++;
@ -354,7 +356,8 @@ int *perform_request(servers_fixture *f, grpc_channel *client,
GPR_ASSERT(rdata->status == GRPC_STATUS_UNIMPLEMENTED);
GPR_ASSERT(0 == strcmp(rdata->details, "xyz"));
GPR_ASSERT(0 == strcmp(rdata->call_details[s_idx].method, "/foo"));
GPR_ASSERT(0 == strcmp(rdata->call_details[s_idx].host, "foo.test.google.fr"));
GPR_ASSERT(0 ==
strcmp(rdata->call_details[s_idx].host, "foo.test.google.fr"));
GPR_ASSERT(was_cancelled == 1);
} else {
}

@ -139,7 +139,7 @@ static int poll_read_bytes(int fd, char *buf, size_t read_size, int spin) {
gpr_log(GPR_ERROR, "Read failed: %s", strerror(errno));
return -1;
}
bytes_read += (size_t) err2;
bytes_read += (size_t)err2;
} while (bytes_read < read_size);
return 0;
}
@ -174,11 +174,11 @@ static int epoll_read_bytes(struct thread_args *args, char *buf, int spin) {
GPR_ASSERT(ev.data.fd == args->fds.read_fd);
do {
do {
err2 = read(args->fds.read_fd, buf + bytes_read,
read_size - bytes_read);
err2 =
read(args->fds.read_fd, buf + bytes_read, read_size - bytes_read);
} while (err2 < 0 && errno == EINTR);
if (errno == EAGAIN) break;
bytes_read += (size_t) err2;
bytes_read += (size_t)err2;
/* TODO(klempner): This should really be doing an extra call after we are
done to ensure we see an EAGAIN */
} while (bytes_read < read_size);

@ -382,8 +382,7 @@ static void test_access_token_creds(void) {
NULL};
GPR_ASSERT(strcmp(creds->type, GRPC_CALL_CREDENTIALS_TYPE_OAUTH2) == 0);
grpc_call_credentials_get_request_metadata(
&exec_ctx, creds, NULL, auth_md_ctx, check_access_token_metadata,
creds);
&exec_ctx, creds, NULL, auth_md_ctx, check_access_token_metadata, creds);
grpc_exec_ctx_finish(&exec_ctx);
}
@ -443,7 +442,8 @@ static void test_oauth2_google_iam_composite_creds(void) {
test_google_iam_authorization_token, test_google_iam_authority_selector,
NULL);
grpc_call_credentials *composite_creds =
grpc_composite_call_credentials_create(oauth2_creds, google_iam_creds, NULL);
grpc_composite_call_credentials_create(oauth2_creds, google_iam_creds,
NULL);
grpc_call_credentials_unref(oauth2_creds);
grpc_call_credentials_unref(google_iam_creds);
GPR_ASSERT(
@ -488,7 +488,8 @@ static void test_channel_oauth2_google_iam_composite_creds(void) {
grpc_call_credentials *oauth2_creds =
grpc_access_token_credentials_create("blah", NULL);
grpc_channel_credentials *channel_oauth2_creds =
grpc_composite_channel_credentials_create(channel_creds, oauth2_creds, NULL);
grpc_composite_channel_credentials_create(channel_creds, oauth2_creds,
NULL);
grpc_call_credentials *google_iam_creds = grpc_google_iam_credentials_create(
test_google_iam_authorization_token, test_google_iam_authority_selector,
NULL);
@ -981,8 +982,8 @@ static void test_metadata_plugin_success(void) {
creds = grpc_metadata_credentials_create_from_plugin(plugin, NULL);
GPR_ASSERT(state == PLUGIN_INITIAL_STATE);
grpc_call_credentials_get_request_metadata(
&exec_ctx, creds, NULL, auth_md_ctx,
on_plugin_metadata_received_success, NULL);
&exec_ctx, creds, NULL, auth_md_ctx, on_plugin_metadata_received_success,
NULL);
GPR_ASSERT(state == PLUGIN_GET_METADATA_CALLED_STATE);
grpc_call_credentials_release(creds);
GPR_ASSERT(state == PLUGIN_DESTROY_CALLED_STATE);
@ -1004,8 +1005,8 @@ static void test_metadata_plugin_failure(void) {
creds = grpc_metadata_credentials_create_from_plugin(plugin, NULL);
GPR_ASSERT(state == PLUGIN_INITIAL_STATE);
grpc_call_credentials_get_request_metadata(
&exec_ctx, creds, NULL, auth_md_ctx,
on_plugin_metadata_received_failure, NULL);
&exec_ctx, creds, NULL, auth_md_ctx, on_plugin_metadata_received_failure,
NULL);
GPR_ASSERT(state == PLUGIN_GET_METADATA_CALLED_STATE);
grpc_call_credentials_release(creds);
GPR_ASSERT(state == PLUGIN_DESTROY_CALLED_STATE);

@ -88,7 +88,8 @@ char *grpc_test_fetch_oauth2_token_with_credentials(
grpc_closure_init(&do_nothing_closure, do_nothing, NULL);
grpc_call_credentials_get_request_metadata(&exec_ctx, creds, &request.pollset,
null_ctx, on_oauth2_response, &request);
null_ctx, on_oauth2_response,
&request);
grpc_exec_ctx_finish(&exec_ctx);

@ -185,8 +185,8 @@ static void test_byte_buffer_from_reader(void) {
}
static void test_readall(void) {
char* lotsa_as[512];
char* lotsa_bs[1024];
char *lotsa_as[512];
char *lotsa_bs[1024];
gpr_slice slices[2];
grpc_byte_buffer *buffer;
grpc_byte_buffer_reader reader;

@ -181,29 +181,29 @@ class Client {
std::unique_ptr<RandomDist> random_dist;
switch (load.load_case()) {
case LoadParams::kClosedLoop:
// Closed-loop doesn't use random dist at all
break;
case LoadParams::kPoisson:
random_dist.reset(
new ExpDist(load.poisson().offered_load() / num_threads));
break;
case LoadParams::kUniform:
random_dist.reset(
new UniformDist(load.uniform().interarrival_lo() * num_threads,
load.uniform().interarrival_hi() * num_threads));
break;
case LoadParams::kDeterm:
random_dist.reset(
new DetDist(num_threads / load.determ().offered_load()));
break;
case LoadParams::kPareto:
random_dist.reset(
new ParetoDist(load.pareto().interarrival_base() * num_threads,
load.pareto().alpha()));
break;
default:
GPR_ASSERT(false);
case LoadParams::kClosedLoop:
// Closed-loop doesn't use random dist at all
break;
case LoadParams::kPoisson:
random_dist.reset(
new ExpDist(load.poisson().offered_load() / num_threads));
break;
case LoadParams::kUniform:
random_dist.reset(
new UniformDist(load.uniform().interarrival_lo() * num_threads,
load.uniform().interarrival_hi() * num_threads));
break;
case LoadParams::kDeterm:
random_dist.reset(
new DetDist(num_threads / load.determ().offered_load()));
break;
case LoadParams::kPareto:
random_dist.reset(
new ParetoDist(load.pareto().interarrival_base() * num_threads,
load.pareto().alpha()));
break;
default:
GPR_ASSERT(false);
}
// Set closed_loop_ based on whether or not random_dist is set

Loading…
Cancel
Save