clang-format codebase

pull/34/head
Craig Tiller 10 years ago
parent 375605b65f
commit 40fc7a6632
  1. 7
      include/grpc/grpc.h
  2. 3
      src/core/surface/byte_buffer.c
  3. 53
      src/core/surface/call.c
  4. 3
      test/core/end2end/dualstack_socket_test.c
  5. 3
      test/core/end2end/no_server_test.c
  6. 4
      test/core/end2end/tests/disappearing_server.c
  7. 8
      test/core/end2end/tests/max_concurrent_streams.c
  8. 4
      test/core/end2end/tests/simple_delayed_request.c
  9. 5
      test/core/end2end/tests/thread_stress.c
  10. 3
      test/core/surface/lame_client_test.c

@ -320,10 +320,9 @@ grpc_call_error grpc_call_add_metadata(grpc_call *call, grpc_metadata *metadata,
Produces a GRPC_FINISHED event with finished_tag when the call has been
completed (there may be other events for the call pending at this
time) */
grpc_call_error grpc_call_invoke(grpc_call *call,
grpc_completion_queue *cq,
void *metadata_read_tag,
void *finished_tag, gpr_uint32 flags);
grpc_call_error grpc_call_invoke(grpc_call *call, grpc_completion_queue *cq,
void *metadata_read_tag, void *finished_tag,
gpr_uint32 flags);
grpc_call_error grpc_call_start_invoke(grpc_call *call,
grpc_completion_queue *cq,
void *invoke_accepted_tag,

@ -52,7 +52,8 @@ grpc_byte_buffer *grpc_byte_buffer_create(gpr_slice *slices, size_t nslices) {
grpc_byte_buffer *grpc_byte_buffer_copy(grpc_byte_buffer *bb) {
switch (bb->type) {
case GRPC_BB_SLICE_BUFFER:
return grpc_byte_buffer_create(bb->data.slice_buffer.slices, bb->data.slice_buffer.count);
return grpc_byte_buffer_create(bb->data.slice_buffer.slices,
bb->data.slice_buffer.count);
}
gpr_log(GPR_INFO, "should never get here");
abort();

@ -357,10 +357,12 @@ grpc_call_error grpc_call_start_invoke(grpc_call *call,
void *invoke_accepted_tag,
void *metadata_read_tag,
void *finished_tag, gpr_uint32 flags) {
grpc_call_error err = grpc_call_invoke(call, cq, metadata_read_tag, finished_tag, flags);
grpc_call_error err =
grpc_call_invoke(call, cq, metadata_read_tag, finished_tag, flags);
if (err == GRPC_CALL_OK) {
grpc_cq_begin_op(call->cq, call, GRPC_INVOKE_ACCEPTED);
grpc_cq_end_invoke_accepted(call->cq, invoke_accepted_tag, call, do_nothing, NULL, GRPC_OP_OK);
grpc_cq_end_invoke_accepted(call->cq, invoke_accepted_tag, call, do_nothing,
NULL, GRPC_OP_OK);
}
return err;
}
@ -421,11 +423,11 @@ static void call_started(void *user_data, grpc_op_error error) {
}
if (pending_writes_done) {
if (ok) {
op.type = GRPC_SEND_FINISH;
op.dir = GRPC_CALL_DOWN;
op.flags = 0;
op.done_cb = done_writes_done;
op.user_data = call;
op.type = GRPC_SEND_FINISH;
op.dir = GRPC_CALL_DOWN;
op.flags = 0;
op.done_cb = done_writes_done;
op.user_data = call;
elem = CALL_ELEM_FROM_CALL(call, 0);
elem->filter->call_op(elem, NULL, &op);
@ -435,10 +437,9 @@ static void call_started(void *user_data, grpc_op_error error) {
}
}
grpc_call_error grpc_call_invoke(grpc_call *call,
grpc_completion_queue *cq,
void *metadata_read_tag,
void *finished_tag, gpr_uint32 flags) {
grpc_call_error grpc_call_invoke(grpc_call *call, grpc_completion_queue *cq,
void *metadata_read_tag, void *finished_tag,
gpr_uint32 flags) {
grpc_call_element *elem;
grpc_call_op op;
@ -708,15 +709,15 @@ grpc_call_error grpc_call_start_write(grpc_call *call,
} else {
gpr_mu_unlock(&call->read_mu);
op.type = GRPC_SEND_MESSAGE;
op.dir = GRPC_CALL_DOWN;
op.flags = flags;
op.done_cb = done_write;
op.user_data = call;
op.data.message = byte_buffer;
op.type = GRPC_SEND_MESSAGE;
op.dir = GRPC_CALL_DOWN;
op.flags = flags;
op.done_cb = done_write;
op.user_data = call;
op.data.message = byte_buffer;
elem = CALL_ELEM_FROM_CALL(call, 0);
elem->filter->call_op(elem, NULL, &op);
elem = CALL_ELEM_FROM_CALL(call, 0);
elem->filter->call_op(elem, NULL, &op);
}
return GRPC_CALL_OK;
@ -757,14 +758,14 @@ grpc_call_error grpc_call_writes_done(grpc_call *call, void *tag) {
} else {
gpr_mu_unlock(&call->read_mu);
op.type = GRPC_SEND_FINISH;
op.dir = GRPC_CALL_DOWN;
op.flags = 0;
op.done_cb = done_writes_done;
op.user_data = call;
op.type = GRPC_SEND_FINISH;
op.dir = GRPC_CALL_DOWN;
op.flags = 0;
op.done_cb = done_writes_done;
op.user_data = call;
elem = CALL_ELEM_FROM_CALL(call, 0);
elem->filter->call_op(elem, NULL, &op);
elem = CALL_ELEM_FROM_CALL(call, 0);
elem->filter->call_op(elem, NULL, &op);
}
return GRPC_CALL_OK;

@ -115,8 +115,7 @@ void test_connect(const char *server_host, const char *client_host, int port,
c = grpc_channel_create_call(client, "/foo", "test.google.com", deadline);
GPR_ASSERT(c);
GPR_ASSERT(GRPC_CALL_OK ==
grpc_call_invoke(c, client_cq, tag(2), tag(3), 0));
GPR_ASSERT(GRPC_CALL_OK == grpc_call_invoke(c, client_cq, tag(2), tag(3), 0));
GPR_ASSERT(GRPC_CALL_OK == grpc_call_writes_done(c, tag(4)));
if (expect_ok) {
/* Check for a successful request. */

@ -57,8 +57,7 @@ int main(int argc, char **argv) {
/* create a call, channel to a non existant server */
chan = grpc_channel_create("nonexistant:54321", NULL);
call = grpc_channel_create_call(chan, "/foo", "nonexistant", deadline);
GPR_ASSERT(grpc_call_invoke(call, cq, tag(2), tag(3), 0) ==
GRPC_CALL_OK);
GPR_ASSERT(grpc_call_invoke(call, cq, tag(2), tag(3), 0) == GRPC_CALL_OK);
/* verify that all tags get completed */
cq_expect_client_metadata_read(cqv, tag(2), NULL);
cq_expect_finished_with_status(cqv, tag(3), GRPC_STATUS_CANCELLED, NULL,

@ -100,8 +100,8 @@ static void do_request_and_shutdown_server(grpc_end2end_test_fixture *f,
c = grpc_channel_create_call(f->client, "/foo", "test.google.com", deadline);
GPR_ASSERT(c);
GPR_ASSERT(GRPC_CALL_OK == grpc_call_invoke(c, f->client_cq,
tag(2), tag(3), 0));
GPR_ASSERT(GRPC_CALL_OK ==
grpc_call_invoke(c, f->client_cq, tag(2), tag(3), 0));
GPR_ASSERT(GRPC_CALL_OK == grpc_call_writes_done(c, tag(4)));
cq_expect_finish_accepted(v_client, tag(4), GRPC_OP_OK);

@ -189,10 +189,10 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) {
GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(f.server, tag(100)));
GPR_ASSERT(GRPC_CALL_OK == grpc_call_invoke(c1, f.client_cq,
tag(301), tag(302), 0));
GPR_ASSERT(GRPC_CALL_OK == grpc_call_invoke(c2, f.client_cq,
tag(401), tag(402), 0));
GPR_ASSERT(GRPC_CALL_OK ==
grpc_call_invoke(c1, f.client_cq, tag(301), tag(302), 0));
GPR_ASSERT(GRPC_CALL_OK ==
grpc_call_invoke(c2, f.client_cq, tag(401), tag(402), 0));
GPR_ASSERT(GRPC_CALL_OK == grpc_call_writes_done(c1, tag(303)));
GPR_ASSERT(GRPC_CALL_OK == grpc_call_writes_done(c2, tag(303)));

@ -106,8 +106,8 @@ static void simple_delayed_request_body(grpc_end2end_test_config config,
c = grpc_channel_create_call(f->client, "/foo", "test.google.com", deadline);
GPR_ASSERT(c);
GPR_ASSERT(GRPC_CALL_OK == grpc_call_invoke(c, f->client_cq,
tag(2), tag(3), 0));
GPR_ASSERT(GRPC_CALL_OK ==
grpc_call_invoke(c, f->client_cq, tag(2), tag(3), 0));
config.init_server(f, server_args);

@ -118,9 +118,8 @@ static void start_request() {
g_active_requests++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_invoke(call, g_fixture.client_cq,
NULL, NULL, NULL, 0));
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_read(call, NULL));
GPR_ASSERT(GRPC_CALL_OK ==
grpc_call_start_write(call, buf, NULL, 0));
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_read(call, NULL));
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_write(call, buf, NULL, 0));
grpc_byte_buffer_destroy(buf);
}

@ -62,8 +62,7 @@ int main(int argc, char **argv) {
GPR_ASSERT(GRPC_CALL_OK == grpc_call_add_metadata(call, &md, 0));
/* and invoke the call */
GPR_ASSERT(GRPC_CALL_OK ==
grpc_call_invoke(call, cq, tag(2), tag(3), 0));
GPR_ASSERT(GRPC_CALL_OK == grpc_call_invoke(call, cq, tag(2), tag(3), 0));
/* the call should immediately fail */
cq_expect_client_metadata_read(cqv, tag(2), NULL);

Loading…
Cancel
Save