From bd37a21c2605abcd07f0aea2e4ddb258a88eda22 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 7 Sep 2016 11:28:56 -0700 Subject: Cleanup, debug support --- test/cpp/qps/client_sync.cc | 3 +++ 1 file changed, 3 insertions(+) (limited to 'test/cpp/qps/client_sync.cc') diff --git a/test/cpp/qps/client_sync.cc b/test/cpp/qps/client_sync.cc index 8062424a1f..ef54b4b766 100644 --- a/test/cpp/qps/client_sync.cc +++ b/test/cpp/qps/client_sync.cc @@ -130,6 +130,9 @@ class SynchronousUnaryClient GRPC_FINAL : public SynchronousClient { grpc::Status s = stub->UnaryCall(&context, request_, &responses_[thread_idx]); entry->set_value((UsageTimer::Now() - start) * 1e9); + if (!s.ok()) { + gpr_log(GPR_ERROR, "RPC error: %d: %s", s.error_code(), s.error_message().c_str()); + } return s.ok(); } }; -- cgit v1.2.3 From 44b12f9e23cbdb5f5f1be0681b81aeded481debf Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 8 Sep 2016 10:06:14 -0700 Subject: clang-format --- src/core/ext/transport/chttp2/transport/writing.c | 41 +++++++++++++---------- src/core/lib/iomgr/closure.c | 4 +-- src/core/lib/iomgr/closure.h | 3 +- src/core/lib/surface/server.c | 3 +- test/cpp/end2end/thread_stress_test.cc | 3 +- test/cpp/qps/client_sync.cc | 3 +- 6 files changed, 33 insertions(+), 24 deletions(-) (limited to 'test/cpp/qps/client_sync.cc') diff --git a/src/core/ext/transport/chttp2/transport/writing.c b/src/core/ext/transport/chttp2/transport/writing.c index 87f4e1e836..bc490569b7 100644 --- a/src/core/ext/transport/chttp2/transport/writing.c +++ b/src/core/ext/transport/chttp2/transport/writing.c @@ -49,7 +49,8 @@ static void add_to_write_list(grpc_chttp2_write_cb **list, static void finish_write_cb(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, grpc_chttp2_stream *s, grpc_chttp2_write_cb *cb, grpc_error *error) { - grpc_chttp2_complete_closure_step(exec_ctx, t, s, &cb->closure, error, "finish_write_cb"); + grpc_chttp2_complete_closure_step(exec_ctx, t, s, &cb->closure, error, + "finish_write_cb"); cb->next = t->write_cb_pool; t->write_cb_pool = cb; } @@ -109,15 +110,17 @@ bool grpc_chttp2_begin_write(grpc_exec_ctx *exec_ctx, bool sent_initial_metadata = s->sent_initial_metadata; bool now_writing = false; - GRPC_CHTTP2_IF_TRACING(gpr_log(GPR_DEBUG, "W:%p %s[%d] im-(sent,send)=(%d,%d) announce=%d", t, t->is_client?"CLIENT":"SERVER", s->id, sent_initial_metadata, s->send_initial_metadata!=NULL, s->announce_window)); + GRPC_CHTTP2_IF_TRACING(gpr_log( + GPR_DEBUG, "W:%p %s[%d] im-(sent,send)=(%d,%d) announce=%d", t, + t->is_client ? "CLIENT" : "SERVER", s->id, sent_initial_metadata, + s->send_initial_metadata != NULL, s->announce_window)); /* send initial metadata if it's available */ if (!sent_initial_metadata && s->send_initial_metadata) { - grpc_chttp2_encode_header(&t->hpack_compressor, s->id, - s->send_initial_metadata, 0, -t->settings[GRPC_ACKED_SETTINGS][GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE], - &s->stats.outgoing, - &t->outbuf); + grpc_chttp2_encode_header( + &t->hpack_compressor, s->id, s->send_initial_metadata, 0, + t->settings[GRPC_ACKED_SETTINGS][GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE], + &s->stats.outgoing, &t->outbuf); s->send_initial_metadata = NULL; s->sent_initial_metadata = true; sent_initial_metadata = true; @@ -135,7 +138,8 @@ t->settings[GRPC_ACKED_SETTINGS][GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE], /* send any body bytes, if allowed by flow control */ if (s->flow_controlled_buffer.length > 0) { uint32_t max_outgoing = - (uint32_t)GPR_MIN(t->settings[GRPC_ACKED_SETTINGS][GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE], + (uint32_t)GPR_MIN(t->settings[GRPC_ACKED_SETTINGS] + [GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE], GPR_MIN(s->outgoing_window, t->outgoing_window)); if (max_outgoing > 0) { uint32_t send_bytes = @@ -176,10 +180,11 @@ t->settings[GRPC_ACKED_SETTINGS][GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE], if (s->send_trailing_metadata != NULL && s->fetching_send_message == NULL && s->flow_controlled_buffer.length == 0) { - grpc_chttp2_encode_header(&t->hpack_compressor, s->id, - s->send_trailing_metadata, true, -t->settings[GRPC_ACKED_SETTINGS][GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE], - &s->stats.outgoing, &t->outbuf); + grpc_chttp2_encode_header( + &t->hpack_compressor, s->id, s->send_trailing_metadata, true, + t->settings[GRPC_ACKED_SETTINGS] + [GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE], + &s->stats.outgoing, &t->outbuf); s->send_trailing_metadata = NULL; s->sent_trailing_metadata = true; if (!t->is_client && !s->read_closed) { @@ -225,9 +230,9 @@ void grpc_chttp2_end_write(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, while (grpc_chttp2_list_pop_writing_stream(t, &s)) { if (s->sent_initial_metadata) { - grpc_chttp2_complete_closure_step(exec_ctx, t, s, - &s->send_initial_metadata_finished, - GRPC_ERROR_REF(error), "send_initial_metadata_finished"); + grpc_chttp2_complete_closure_step( + exec_ctx, t, s, &s->send_initial_metadata_finished, + GRPC_ERROR_REF(error), "send_initial_metadata_finished"); } if (s->sending_bytes != 0) { update_list(exec_ctx, t, s, s->sending_bytes, &s->on_write_finished_cbs, @@ -235,9 +240,9 @@ void grpc_chttp2_end_write(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, s->sending_bytes = 0; } if (s->sent_trailing_metadata) { - grpc_chttp2_complete_closure_step(exec_ctx, t, s, - &s->send_trailing_metadata_finished, - GRPC_ERROR_REF(error), "send_trailing_metadata_finished"); + grpc_chttp2_complete_closure_step( + exec_ctx, t, s, &s->send_trailing_metadata_finished, + GRPC_ERROR_REF(error), "send_trailing_metadata_finished"); grpc_chttp2_mark_stream_closed(exec_ctx, t, s, !t->is_client, 1, GRPC_ERROR_REF(error)); } diff --git a/src/core/lib/iomgr/closure.c b/src/core/lib/iomgr/closure.c index 5cbd6bd7a5..2c84e82aca 100644 --- a/src/core/lib/iomgr/closure.c +++ b/src/core/lib/iomgr/closure.c @@ -113,10 +113,10 @@ grpc_closure *grpc_closure_create(grpc_iomgr_cb_func cb, void *cb_arg) { return &wc->wrapper; } -void grpc_closure_run(grpc_exec_ctx *exec_ctx, grpc_closure *c, grpc_error *error) { +void grpc_closure_run(grpc_exec_ctx *exec_ctx, grpc_closure *c, + grpc_error *error) { GPR_TIMER_BEGIN("grpc_closure_run", 0); c->cb(exec_ctx, c->cb_arg, error); GRPC_ERROR_UNREF(error); GPR_TIMER_END("grpc_closure_run", 0); } - diff --git a/src/core/lib/iomgr/closure.h b/src/core/lib/iomgr/closure.h index 29ed19cb4f..2b4b271eaa 100644 --- a/src/core/lib/iomgr/closure.h +++ b/src/core/lib/iomgr/closure.h @@ -112,6 +112,7 @@ bool grpc_closure_list_empty(grpc_closure_list list); /** Run a closure directly. Caller ensures that no locks are being held above. * Note that calling this at the end of a closure callback function itself is * by definition safe. */ -void grpc_closure_run(grpc_exec_ctx *exec_ctx, grpc_closure *closure, grpc_error *error); +void grpc_closure_run(grpc_exec_ctx *exec_ctx, grpc_closure *closure, + grpc_error *error); #endif /* GRPC_CORE_LIB_IOMGR_CLOSURE_H */ diff --git a/src/core/lib/surface/server.c b/src/core/lib/surface/server.c index 8f9b995265..9a9fcddb6e 100644 --- a/src/core/lib/surface/server.c +++ b/src/core/lib/surface/server.c @@ -447,7 +447,8 @@ static void destroy_channel(grpc_exec_ctx *exec_ctx, channel_data *chand, } GRPC_ERROR_UNREF(error); - grpc_transport_op *op = grpc_make_transport_op(&chand->finish_destroy_channel_closure); + grpc_transport_op *op = + grpc_make_transport_op(&chand->finish_destroy_channel_closure); op->set_accept_stream = true; grpc_channel_next_op(exec_ctx, grpc_channel_stack_element( diff --git a/test/cpp/end2end/thread_stress_test.cc b/test/cpp/end2end/thread_stress_test.cc index ebede19a7f..0b9d4cda9f 100644 --- a/test/cpp/end2end/thread_stress_test.cc +++ b/test/cpp/end2end/thread_stress_test.cc @@ -340,7 +340,8 @@ static void SendRpc(grpc::testing::EchoTestService::Stub* stub, int num_rpcs) { Status s = stub->Echo(&context, request, &response); EXPECT_EQ(response.message(), request.message()); if (!s.ok()) { - gpr_log(GPR_ERROR, "RPC error: %d: %s", s.error_code(), s.error_message().c_str()); + gpr_log(GPR_ERROR, "RPC error: %d: %s", s.error_code(), + s.error_message().c_str()); } ASSERT_TRUE(s.ok()); } diff --git a/test/cpp/qps/client_sync.cc b/test/cpp/qps/client_sync.cc index ef54b4b766..0ccf4e270b 100644 --- a/test/cpp/qps/client_sync.cc +++ b/test/cpp/qps/client_sync.cc @@ -131,7 +131,8 @@ class SynchronousUnaryClient GRPC_FINAL : public SynchronousClient { stub->UnaryCall(&context, request_, &responses_[thread_idx]); entry->set_value((UsageTimer::Now() - start) * 1e9); if (!s.ok()) { - gpr_log(GPR_ERROR, "RPC error: %d: %s", s.error_code(), s.error_message().c_str()); + gpr_log(GPR_ERROR, "RPC error: %d: %s", s.error_code(), + s.error_message().c_str()); } return s.ok(); } -- cgit v1.2.3 From 86cb138ee9c852839dfd33529e8634ffe09d896e Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 27 Oct 2016 15:29:49 -0700 Subject: Handle failed calls in sync client --- test/cpp/qps/client_sync.cc | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'test/cpp/qps/client_sync.cc') diff --git a/test/cpp/qps/client_sync.cc b/test/cpp/qps/client_sync.cc index 0ccf4e270b..f61e80d76b 100644 --- a/test/cpp/qps/client_sync.cc +++ b/test/cpp/qps/client_sync.cc @@ -130,11 +130,8 @@ class SynchronousUnaryClient GRPC_FINAL : public SynchronousClient { grpc::Status s = stub->UnaryCall(&context, request_, &responses_[thread_idx]); entry->set_value((UsageTimer::Now() - start) * 1e9); - if (!s.ok()) { - gpr_log(GPR_ERROR, "RPC error: %d: %s", s.error_code(), - s.error_message().c_str()); - } - return s.ok(); + entry->set_status(s.error_code()); + return true; } }; -- cgit v1.2.3