clang formatting

pull/515/head
Abhishek Kumar 10 years ago
parent 445612ec18
commit e3dd33ff8c
  1. 12
      test/core/fling/client.c
  2. 32
      test/core/fling/server.c

@ -95,8 +95,8 @@ static void init_ping_pong_stream(void) {
"localhost", gpr_inf_future);
stream_init_op.op = GRPC_OP_SEND_INITIAL_METADATA;
stream_init_op.data.send_initial_metadata.count = 0;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(call, &stream_init_op, 1,
(void *)1));
GPR_ASSERT(GRPC_CALL_OK ==
grpc_call_start_batch(call, &stream_init_op, 1, (void *)1));
grpc_event_finish(grpc_completion_queue_next(cq, gpr_inf_future));
grpc_metadata_array_init(&initial_metadata_recv);
@ -108,8 +108,8 @@ static void init_ping_pong_stream(void) {
}
static void step_ping_pong_stream(void) {
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(call, stream_step_ops, 2,
(void *)1));
GPR_ASSERT(GRPC_CALL_OK ==
grpc_call_start_batch(call, stream_step_ops, 2, (void *)1));
grpc_event_finish(grpc_completion_queue_next(cq, gpr_inf_future));
}
@ -126,7 +126,8 @@ typedef struct {
static const scenario scenarios[] = {
{"ping-pong-request", init_ping_pong_request, step_ping_pong_request},
{"ping-pong-stream", init_ping_pong_stream, step_ping_pong_stream}, };
{"ping-pong-stream", init_ping_pong_stream, step_ping_pong_stream},
};
int main(int argc, char **argv) {
gpr_slice slice = gpr_slice_from_copied_string("x");
@ -176,7 +177,6 @@ int main(int argc, char **argv) {
the_buffer = grpc_byte_buffer_create(&slice, payload_size);
histogram = gpr_histogram_create(0.01, 60e9);
sc.init();
for (i = 0; i < 1000; i++) {

@ -60,7 +60,6 @@ static grpc_byte_buffer *payload_buffer = NULL;
/* Used to drain the terminal read in unary calls. */
static grpc_byte_buffer *terminal_buffer = NULL;
static grpc_op read_op;
static grpc_op metadata_send_op;
static grpc_op write_op;
@ -101,24 +100,22 @@ static void handle_unary_method(void) {
unary_ops[4].op = GRPC_OP_RECV_CLOSE_ON_SERVER;
unary_ops[4].data.recv_close_on_server.cancelled = &was_cancelled;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(call, unary_ops, 5,
tag(6)));
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(call, unary_ops, 5, tag(6)));
}
static void send_initial_metadata(void) {
grpc_metadata_array_init(&initial_metadata_send);
metadata_send_op.op = GRPC_OP_SEND_INITIAL_METADATA;
metadata_send_op.data.send_initial_metadata.count = 0;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(call, &metadata_send_op, 1,
tag(3)));
GPR_ASSERT(GRPC_CALL_OK ==
grpc_call_start_batch(call, &metadata_send_op, 1, tag(3)));
}
static void start_read_op(int t) {
/* Starting read at server */
read_op.op = GRPC_OP_RECV_MESSAGE;
read_op.data.recv_message = &payload_buffer;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(call, &read_op, 1,
tag(t)));
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(call, &read_op, 1, tag(t)));
}
static void start_write_op(void) {
@ -128,11 +125,9 @@ static void start_write_op(void) {
gpr_log(GPR_INFO, "NULL payload buffer !!!");
}
write_op.data.send_message = payload_buffer;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(call, &write_op, 1,
tag(2)));
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(call, &write_op, 1, tag(2)));
}
static void start_send_status(void) {
status_op[0].op = GRPC_OP_SEND_STATUS_FROM_SERVER;
status_op[0].data.send_status_from_server.status = GRPC_STATUS_OK;
@ -141,8 +136,7 @@ static void start_send_status(void) {
status_op[1].op = GRPC_OP_RECV_CLOSE_ON_SERVER;
status_op[1].data.recv_close_on_server.cancelled = &was_cancelled;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(call, status_op, 2,
tag(4)));
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(call, status_op, 2, tag(4)));
}
static void sigint_handler(int x) { got_sigint = 1; }
@ -214,11 +208,11 @@ int main(int argc, char **argv) {
s = ev->tag;
switch (ev->type) {
case GRPC_OP_COMPLETE:
switch ((gpr_intptr) s) {
switch ((gpr_intptr)s) {
case 101:
if(call != NULL) {
if (0 == strcmp(call_details.method,
"/Reflector/reflectStream")) {
if (call != NULL) {
if (0 ==
strcmp(call_details.method, "/Reflector/reflectStream")) {
/* Received streaming call. Send metadata here. */
start_read_op(1);
send_initial_metadata();
@ -226,8 +220,7 @@ int main(int argc, char **argv) {
/* Received unary call. Can do all ops in one batch. */
start_read_op(5);
}
}
else {
} else {
GPR_ASSERT(shutdown_started);
}
/* request_call();
@ -237,8 +230,7 @@ int main(int argc, char **argv) {
if (payload_buffer != NULL) {
/* Received payload from client. */
start_write_op();
}
else {
} else {
/* Received end of stream from client. */
start_send_status();
}

Loading…
Cancel
Save