From 5c8737d1715ea0fe66ac737f46e34a9ac4f15ec0 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 21 May 2015 11:42:17 -0700 Subject: [PATCH] clang-format qps code - it was getting out of hand --- test/cpp/qps/client.h | 43 +++++++------- test/cpp/qps/client_async.cc | 89 ++++++++++++++-------------- test/cpp/qps/client_sync.cc | 14 +++-- test/cpp/qps/driver.cc | 5 +- test/cpp/qps/qps_driver.cc | 4 +- test/cpp/qps/qps_worker.cc | 24 ++++---- test/cpp/qps/report.cc | 16 ++--- test/cpp/qps/server_async.cc | 110 ++++++++++++++++++----------------- test/cpp/qps/server_sync.cc | 16 ++--- test/cpp/qps/worker.cc | 4 +- 10 files changed, 170 insertions(+), 155 deletions(-) diff --git a/test/cpp/qps/client.h b/test/cpp/qps/client.h index 2dc5b3860f3..dc3a9f2ac58 100644 --- a/test/cpp/qps/client.h +++ b/test/cpp/qps/client.h @@ -113,24 +113,26 @@ class Client { : done_(false), new_(nullptr), impl_([this, idx, client]() { - for (;;) { - // run the loop body - bool thread_still_ok = client->ThreadFunc(&histogram_, idx); - // lock, see if we're done - std::lock_guard g(mu_); - if (!thread_still_ok) { - gpr_log(GPR_ERROR, "Finishing client thread due to RPC error"); - done_ = true; - } - if (done_) {return;} - // check if we're marking, swap out the histogram if so - if (new_) { - new_->Swap(&histogram_); - new_ = nullptr; - cv_.notify_one(); - } + for (;;) { + // run the loop body + bool thread_still_ok = client->ThreadFunc(&histogram_, idx); + // lock, see if we're done + std::lock_guard g(mu_); + if (!thread_still_ok) { + gpr_log(GPR_ERROR, "Finishing client thread due to RPC error"); + done_ = true; } - }) {} + if (done_) { + return; + } + // check if we're marking, swap out the histogram if so + if (new_) { + new_->Swap(&histogram_); + new_ = nullptr; + cv_.notify_one(); + } + } + }) {} ~Thread() { { @@ -168,10 +170,9 @@ class Client { std::unique_ptr timer_; }; -std::unique_ptr - CreateSynchronousUnaryClient(const ClientConfig& args); -std::unique_ptr - CreateSynchronousStreamingClient(const ClientConfig& args); +std::unique_ptr CreateSynchronousUnaryClient(const ClientConfig& args); +std::unique_ptr CreateSynchronousStreamingClient( + const ClientConfig& args); std::unique_ptr CreateAsyncUnaryClient(const ClientConfig& args); std::unique_ptr CreateAsyncStreamingClient(const ClientConfig& args); diff --git a/test/cpp/qps/client_async.cc b/test/cpp/qps/client_async.cc index e3ab57728da..00bbd8a8a07 100644 --- a/test/cpp/qps/client_async.cc +++ b/test/cpp/qps/client_async.cc @@ -128,16 +128,16 @@ class ClientRpcContextUnaryImpl : public ClientRpcContext { class AsyncClient : public Client { public: explicit AsyncClient(const ClientConfig& config, - std::function setup_ctx) : - Client(config) { + std::function setup_ctx) + : Client(config) { for (int i = 0; i < config.async_client_threads(); i++) { cli_cqs_.emplace_back(new CompletionQueue); } int t = 0; for (int i = 0; i < config.outstanding_rpcs_per_channel(); i++) { for (auto channel = channels_.begin(); channel != channels_.end(); - channel++) { + channel++) { auto* cq = cli_cqs_[t].get(); t = (t + 1) % cli_cqs_.size(); setup_ctx(cq, channel->get_stub(), request_); @@ -155,16 +155,19 @@ class AsyncClient : public Client { } } - bool ThreadFunc(Histogram* histogram, size_t thread_idx) - GRPC_OVERRIDE GRPC_FINAL { + bool ThreadFunc(Histogram* histogram, + size_t thread_idx) GRPC_OVERRIDE GRPC_FINAL { void* got_tag; bool ok; - switch (cli_cqs_[thread_idx]->AsyncNext(&got_tag, &ok, - std::chrono::system_clock::now() + - std::chrono::seconds(1))) { - case CompletionQueue::SHUTDOWN: return false; - case CompletionQueue::TIMEOUT: return true; - case CompletionQueue::GOT_EVENT: break; + switch (cli_cqs_[thread_idx]->AsyncNext( + &got_tag, &ok, + std::chrono::system_clock::now() + std::chrono::seconds(1))) { + case CompletionQueue::SHUTDOWN: + return false; + case CompletionQueue::TIMEOUT: + return true; + case CompletionQueue::GOT_EVENT: + break; } ClientRpcContext* ctx = ClientRpcContext::detag(got_tag); @@ -177,18 +180,20 @@ class AsyncClient : public Client { return true; } + private: std::vector> cli_cqs_; }; class AsyncUnaryClient GRPC_FINAL : public AsyncClient { public: - explicit AsyncUnaryClient(const ClientConfig& config) : - AsyncClient(config, SetupCtx) { + explicit AsyncUnaryClient(const ClientConfig& config) + : AsyncClient(config, SetupCtx) { StartThreads(config.async_client_threads()); } ~AsyncUnaryClient() GRPC_OVERRIDE { EndThreads(); } -private: + + private: static void SetupCtx(CompletionQueue* cq, TestService::Stub* stub, const SimpleRequest& req) { auto check_done = [](grpc::Status s, SimpleResponse* response) {}; @@ -205,12 +210,11 @@ template class ClientRpcContextStreamingImpl : public ClientRpcContext { public: ClientRpcContextStreamingImpl( - TestService::Stub *stub, const RequestType &req, - std::function< - std::unique_ptr>( - TestService::Stub *, grpc::ClientContext *, void *)> start_req, - std::function on_done) + TestService::Stub* stub, const RequestType& req, + std::function>( + TestService::Stub*, grpc::ClientContext*, void*)> start_req, + std::function on_done) : context_(), stub_(stub), req_(req), @@ -221,7 +225,7 @@ class ClientRpcContextStreamingImpl : public ClientRpcContext { start_(Timer::Now()), stream_(start_req_(stub_, &context_, ClientRpcContext::tag(this))) {} ~ClientRpcContextStreamingImpl() GRPC_OVERRIDE {} - bool RunNextState(bool ok, Histogram *hist) GRPC_OVERRIDE { + bool RunNextState(bool ok, Histogram* hist) GRPC_OVERRIDE { return (this->*next_state_)(ok, hist); } void StartNewClone() GRPC_OVERRIDE { @@ -229,59 +233,58 @@ class ClientRpcContextStreamingImpl : public ClientRpcContext { } private: - bool ReqSent(bool ok, Histogram *) { - return StartWrite(ok); - } + bool ReqSent(bool ok, Histogram*) { return StartWrite(ok); } bool StartWrite(bool ok) { if (!ok) { - return(false); + return (false); } start_ = Timer::Now(); next_state_ = &ClientRpcContextStreamingImpl::WriteDone; stream_->Write(req_, ClientRpcContext::tag(this)); return true; } - bool WriteDone(bool ok, Histogram *) { + bool WriteDone(bool ok, Histogram*) { if (!ok) { - return(false); + return (false); } next_state_ = &ClientRpcContextStreamingImpl::ReadDone; stream_->Read(&response_, ClientRpcContext::tag(this)); return true; } - bool ReadDone(bool ok, Histogram *hist) { + bool ReadDone(bool ok, Histogram* hist) { hist->Add((Timer::Now() - start_) * 1e9); return StartWrite(ok); } grpc::ClientContext context_; - TestService::Stub *stub_; + TestService::Stub* stub_; RequestType req_; ResponseType response_; - bool (ClientRpcContextStreamingImpl::*next_state_)(bool, Histogram *); - std::function callback_; - std::function>( - TestService::Stub *, grpc::ClientContext *, void *)> start_req_; + bool (ClientRpcContextStreamingImpl::*next_state_)(bool, Histogram*); + std::function callback_; + std::function< + std::unique_ptr>( + TestService::Stub*, grpc::ClientContext*, void*)> start_req_; grpc::Status status_; double start_; - std::unique_ptr> - stream_; + std::unique_ptr> + stream_; }; class AsyncStreamingClient GRPC_FINAL : public AsyncClient { public: - explicit AsyncStreamingClient(const ClientConfig &config) : - AsyncClient(config, SetupCtx) { + explicit AsyncStreamingClient(const ClientConfig& config) + : AsyncClient(config, SetupCtx) { StartThreads(config.async_client_threads()); } ~AsyncStreamingClient() GRPC_OVERRIDE { EndThreads(); } -private: + + private: static void SetupCtx(CompletionQueue* cq, TestService::Stub* stub, - const SimpleRequest& req) { + const SimpleRequest& req) { auto check_done = [](grpc::Status s, SimpleResponse* response) {}; - auto start_req = [cq](TestService::Stub *stub, grpc::ClientContext *ctx, - void *tag) { + auto start_req = [cq](TestService::Stub* stub, grpc::ClientContext* ctx, + void* tag) { auto stream = stub->AsyncStreamingCall(ctx, cq, tag); return stream; }; diff --git a/test/cpp/qps/client_sync.cc b/test/cpp/qps/client_sync.cc index 264293561dc..c28dc913213 100644 --- a/test/cpp/qps/client_sync.cc +++ b/test/cpp/qps/client_sync.cc @@ -99,7 +99,9 @@ class SynchronousUnaryClient GRPC_FINAL : public SynchronousClient { class SynchronousStreamingClient GRPC_FINAL : public SynchronousClient { public: SynchronousStreamingClient(const ClientConfig& config) - : SynchronousClient(config), context_(num_threads_), stream_(num_threads_) { + : SynchronousClient(config), + context_(num_threads_), + stream_(num_threads_) { for (size_t thread_idx = 0; thread_idx < num_threads_; thread_idx++) { auto* stub = channels_[thread_idx % channels_.size()].get_stub(); stream_[thread_idx] = stub->StreamingCall(&context_[thread_idx]); @@ -110,8 +112,8 @@ class SynchronousStreamingClient GRPC_FINAL : public SynchronousClient { EndThreads(); for (auto stream = stream_.begin(); stream != stream_.end(); stream++) { if (*stream) { - (*stream)->WritesDone(); - EXPECT_TRUE((*stream)->Finish().IsOk()); + (*stream)->WritesDone(); + EXPECT_TRUE((*stream)->Finish().IsOk()); } } } @@ -119,7 +121,7 @@ class SynchronousStreamingClient GRPC_FINAL : public SynchronousClient { bool ThreadFunc(Histogram* histogram, size_t thread_idx) GRPC_OVERRIDE { double start = Timer::Now(); if (stream_[thread_idx]->Write(request_) && - stream_[thread_idx]->Read(&responses_[thread_idx])) { + stream_[thread_idx]->Read(&responses_[thread_idx])) { histogram->Add((Timer::Now() - start) * 1e9); return true; } @@ -128,8 +130,8 @@ class SynchronousStreamingClient GRPC_FINAL : public SynchronousClient { private: std::vector context_; - std::vector>> stream_; + std::vector>> stream_; }; std::unique_ptr CreateSynchronousUnaryClient( diff --git a/test/cpp/qps/driver.cc b/test/cpp/qps/driver.cc index 682d515ebea..bf12730f97f 100644 --- a/test/cpp/qps/driver.cc +++ b/test/cpp/qps/driver.cc @@ -105,7 +105,7 @@ std::unique_ptr RunScenario( if (!called_init) { char args_buf[100]; strcpy(args_buf, "some-benchmark"); - char *args[] = {args_buf}; + char* args[] = {args_buf}; grpc_test_init(1, args); called_init = true; } @@ -211,7 +211,8 @@ std::unique_ptr RunScenario( // Wait some time gpr_log(GPR_INFO, "Running"); - gpr_sleep_until(gpr_time_add(start, gpr_time_from_seconds(benchmark_seconds))); + gpr_sleep_until( + gpr_time_add(start, gpr_time_from_seconds(benchmark_seconds))); // Finish a run std::unique_ptr result(new ScenarioResult); diff --git a/test/cpp/qps/qps_driver.cc b/test/cpp/qps/qps_driver.cc index f49cd38b339..008830de4ef 100644 --- a/test/cpp/qps/qps_driver.cc +++ b/test/cpp/qps/qps_driver.cc @@ -100,8 +100,8 @@ int main(int argc, char** argv) { // client will deadlock on a timer. GPR_ASSERT(!(server_type == grpc::testing::SYNCHRONOUS_SERVER && rpc_type == grpc::testing::STREAMING && - FLAGS_server_threads < FLAGS_client_channels * - FLAGS_outstanding_rpcs_per_channel)); + FLAGS_server_threads < + FLAGS_client_channels * FLAGS_outstanding_rpcs_per_channel)); const auto result = RunScenario( client_config, FLAGS_num_clients, server_config, FLAGS_num_servers, diff --git a/test/cpp/qps/qps_worker.cc b/test/cpp/qps/qps_worker.cc index 46d70dce529..fb49271991c 100644 --- a/test/cpp/qps/qps_worker.cc +++ b/test/cpp/qps/qps_worker.cc @@ -64,17 +64,19 @@ namespace testing { std::unique_ptr CreateClient(const ClientConfig& config) { switch (config.client_type()) { case ClientType::SYNCHRONOUS_CLIENT: - return (config.rpc_type() == RpcType::UNARY) ? - CreateSynchronousUnaryClient(config) : - CreateSynchronousStreamingClient(config); + return (config.rpc_type() == RpcType::UNARY) + ? CreateSynchronousUnaryClient(config) + : CreateSynchronousStreamingClient(config); case ClientType::ASYNC_CLIENT: - return (config.rpc_type() == RpcType::UNARY) ? - CreateAsyncUnaryClient(config) : CreateAsyncStreamingClient(config); + return (config.rpc_type() == RpcType::UNARY) + ? CreateAsyncUnaryClient(config) + : CreateAsyncStreamingClient(config); } abort(); } -std::unique_ptr CreateServer(const ServerConfig& config, int server_port) { +std::unique_ptr CreateServer(const ServerConfig& config, + int server_port) { switch (config.server_type()) { case ServerType::SYNCHRONOUS_SERVER: return CreateSynchronousServer(config, server_port); @@ -86,7 +88,8 @@ std::unique_ptr CreateServer(const ServerConfig& config, int server_port class WorkerImpl GRPC_FINAL : public Worker::Service { public: - explicit WorkerImpl(int server_port) : server_port_(server_port), acquired_(false) {} + explicit WorkerImpl(int server_port) + : server_port_(server_port), acquired_(false) {} Status RunTest(ServerContext* ctx, ServerReaderWriter* stream) @@ -97,7 +100,7 @@ class WorkerImpl GRPC_FINAL : public Worker::Service { } grpc_profiler_start("qps_client.prof"); - Status ret = RunTestBody(ctx,stream); + Status ret = RunTestBody(ctx, stream); grpc_profiler_stop(); return ret; } @@ -111,7 +114,7 @@ class WorkerImpl GRPC_FINAL : public Worker::Service { } grpc_profiler_start("qps_server.prof"); - Status ret = RunServerBody(ctx,stream); + Status ret = RunServerBody(ctx, stream); grpc_profiler_stop(); return ret; } @@ -226,8 +229,7 @@ QpsWorker::QpsWorker(int driver_port, int server_port) { server_ = std::move(builder.BuildAndStart()); } -QpsWorker::~QpsWorker() { -} +QpsWorker::~QpsWorker() {} } // namespace testing } // namespace grpc diff --git a/test/cpp/qps/report.cc b/test/cpp/qps/report.cc index 29d88da344a..3115ff3bfb7 100644 --- a/test/cpp/qps/report.cc +++ b/test/cpp/qps/report.cc @@ -48,18 +48,20 @@ void ReportQPS(const ScenarioResult& result) { } // QPS: XXX (YYY/server core) -void ReportQPSPerCore(const ScenarioResult& result, const ServerConfig& server_config) { - auto qps = - result.latencies.Count() / - average(result.client_resources, - [](ResourceUsage u) { return u.wall_time; }); +void ReportQPSPerCore(const ScenarioResult& result, + const ServerConfig& server_config) { + auto qps = result.latencies.Count() / + average(result.client_resources, + [](ResourceUsage u) { return u.wall_time; }); - gpr_log(GPR_INFO, "QPS: %.1f (%.1f/server core)", qps, qps/server_config.threads()); + gpr_log(GPR_INFO, "QPS: %.1f (%.1f/server core)", qps, + qps / server_config.threads()); } // Latency (50/90/95/99/99.9%-ile): AA/BB/CC/DD/EE us void ReportLatency(const ScenarioResult& result) { - gpr_log(GPR_INFO, "Latencies (50/90/95/99/99.9%%-ile): %.1f/%.1f/%.1f/%.1f/%.1f us", + gpr_log(GPR_INFO, + "Latencies (50/90/95/99/99.9%%-ile): %.1f/%.1f/%.1f/%.1f/%.1f us", result.latencies.Percentile(50) / 1000, result.latencies.Percentile(90) / 1000, result.latencies.Percentile(95) / 1000, diff --git a/test/cpp/qps/server_async.cc b/test/cpp/qps/server_async.cc index 6cb3192908d..58499f345f5 100644 --- a/test/cpp/qps/server_async.cc +++ b/test/cpp/qps/server_async.cc @@ -64,7 +64,7 @@ namespace testing { class AsyncQpsServerTest : public Server { public: AsyncQpsServerTest(const ServerConfig &config, int port) : shutdown_(false) { - char* server_address = NULL; + char *server_address = NULL; gpr_join_host_port(&server_address, "::", port); ServerBuilder builder; @@ -95,9 +95,9 @@ class AsyncQpsServerTest : public Server { threads_.push_back(std::thread([=]() { // Wait until work is available or we are shutting down bool ok; - void* got_tag; + void *got_tag; while (srv_cq_->Next(&got_tag, &ok)) { - ServerRpcContext* ctx = detag(got_tag); + ServerRpcContext *ctx = detag(got_tag); // The tag is a pointer to an RPC context to invoke if (ctx->RunNextState(ok) == false) { // this RPC context is done, so refresh it @@ -133,23 +133,23 @@ class AsyncQpsServerTest : public Server { ServerRpcContext() {} virtual ~ServerRpcContext(){}; virtual bool RunNextState(bool) = 0; // next state, return false if done - virtual void Reset() = 0; // start this back at a clean state + virtual void Reset() = 0; // start this back at a clean state }; - static void* tag(ServerRpcContext* func) { - return reinterpret_cast(func); + static void *tag(ServerRpcContext *func) { + return reinterpret_cast(func); } - static ServerRpcContext* detag(void* tag) { - return reinterpret_cast(tag); + static ServerRpcContext *detag(void *tag) { + return reinterpret_cast(tag); } template class ServerRpcContextUnaryImpl GRPC_FINAL : public ServerRpcContext { public: ServerRpcContextUnaryImpl( - std::function*, - void*)> request_method, - std::function + std::function *, + void *)> request_method, + std::function invoke_method) : next_state_(&ServerRpcContextUnaryImpl::invoker), request_method_(request_method), @@ -159,7 +159,9 @@ class AsyncQpsServerTest : public Server { AsyncQpsServerTest::tag(this)); } ~ServerRpcContextUnaryImpl() GRPC_OVERRIDE {} - bool RunNextState(bool ok) GRPC_OVERRIDE {return (this->*next_state_)(ok);} + bool RunNextState(bool ok) GRPC_OVERRIDE { + return (this->*next_state_)(ok); + } void Reset() GRPC_OVERRIDE { srv_ctx_ = ServerContext(); req_ = RequestType(); @@ -192,10 +194,10 @@ class AsyncQpsServerTest : public Server { ServerContext srv_ctx_; RequestType req_; bool (ServerRpcContextUnaryImpl::*next_state_)(bool); - std::function*, void*)> + std::function *, void *)> request_method_; - std::function + std::function invoke_method_; grpc::ServerAsyncResponseWriter response_writer_; }; @@ -204,9 +206,9 @@ class AsyncQpsServerTest : public Server { class ServerRpcContextStreamingImpl GRPC_FINAL : public ServerRpcContext { public: ServerRpcContextStreamingImpl( - std::function *, void *)> request_method, + std::function *, + void *)> request_method, std::function invoke_method) : next_state_(&ServerRpcContextStreamingImpl::request_done), @@ -215,14 +217,15 @@ class AsyncQpsServerTest : public Server { stream_(&srv_ctx_) { request_method_(&srv_ctx_, &stream_, AsyncQpsServerTest::tag(this)); } - ~ServerRpcContextStreamingImpl() GRPC_OVERRIDE { + ~ServerRpcContextStreamingImpl() GRPC_OVERRIDE {} + bool RunNextState(bool ok) GRPC_OVERRIDE { + return (this->*next_state_)(ok); } - bool RunNextState(bool ok) GRPC_OVERRIDE {return (this->*next_state_)(ok);} void Reset() GRPC_OVERRIDE { srv_ctx_ = ServerContext(); req_ = RequestType(); - stream_ = grpc::ServerAsyncReaderWriter(&srv_ctx_); + stream_ = + grpc::ServerAsyncReaderWriter(&srv_ctx_); // Then request the method next_state_ = &ServerRpcContextStreamingImpl::request_done; @@ -241,47 +244,47 @@ class AsyncQpsServerTest : public Server { bool read_done(bool ok) { if (ok) { - // invoke the method - ResponseType response; - // Call the RPC processing function - grpc::Status status = invoke_method_(&req_, &response); - // initiate the write - stream_.Write(response, AsyncQpsServerTest::tag(this)); - next_state_ = &ServerRpcContextStreamingImpl::write_done; - } else { // client has sent writes done - // finish the stream - stream_.Finish(Status::OK, AsyncQpsServerTest::tag(this)); - next_state_ = &ServerRpcContextStreamingImpl::finish_done; + // invoke the method + ResponseType response; + // Call the RPC processing function + grpc::Status status = invoke_method_(&req_, &response); + // initiate the write + stream_.Write(response, AsyncQpsServerTest::tag(this)); + next_state_ = &ServerRpcContextStreamingImpl::write_done; + } else { // client has sent writes done + // finish the stream + stream_.Finish(Status::OK, AsyncQpsServerTest::tag(this)); + next_state_ = &ServerRpcContextStreamingImpl::finish_done; } return true; } bool write_done(bool ok) { // now go back and get another streaming read! if (ok) { - stream_.Read(&req_, AsyncQpsServerTest::tag(this)); - next_state_ = &ServerRpcContextStreamingImpl::read_done; - } - else { - stream_.Finish(Status::OK, AsyncQpsServerTest::tag(this)); - next_state_ = &ServerRpcContextStreamingImpl::finish_done; + stream_.Read(&req_, AsyncQpsServerTest::tag(this)); + next_state_ = &ServerRpcContextStreamingImpl::read_done; + } else { + stream_.Finish(Status::OK, AsyncQpsServerTest::tag(this)); + next_state_ = &ServerRpcContextStreamingImpl::finish_done; } return true; } - bool finish_done(bool ok) {return false; /* reset the context */ } + bool finish_done(bool ok) { return false; /* reset the context */ } ServerContext srv_ctx_; RequestType req_; bool (ServerRpcContextStreamingImpl::*next_state_)(bool); - std::function *, void *)> request_method_; + std::function *, void *)> + request_method_; std::function invoke_method_; - grpc::ServerAsyncReaderWriter stream_; + grpc::ServerAsyncReaderWriter stream_; }; - static Status ProcessRPC(const SimpleRequest* request, - SimpleResponse* response) { + static Status ProcessRPC(const SimpleRequest *request, + SimpleResponse *response) { if (request->response_size() > 0) { if (!SetPayload(request->response_type(), request->response_size(), response->mutable_payload())) { @@ -294,19 +297,20 @@ class AsyncQpsServerTest : public Server { std::unique_ptr server_; std::unique_ptr srv_cq_; TestService::AsyncService async_service_; - std::function*, void*)> + std::function *, void *)> request_unary_; - std::function*, void*)> + std::function *, void *)> request_streaming_; - std::forward_list contexts_; + std::forward_list contexts_; std::mutex shutdown_mutex_; bool shutdown_; }; -std::unique_ptr CreateAsyncServer(const ServerConfig& config, +std::unique_ptr CreateAsyncServer(const ServerConfig &config, int port) { return std::unique_ptr(new AsyncQpsServerTest(config, port)); } diff --git a/test/cpp/qps/server_sync.cc b/test/cpp/qps/server_sync.cc index 2770233a7c0..bc00de9cedb 100644 --- a/test/cpp/qps/server_sync.cc +++ b/test/cpp/qps/server_sync.cc @@ -70,18 +70,18 @@ class TestServiceImpl GRPC_FINAL : public TestService::Service { } return Status::OK; } - Status StreamingCall(ServerContext *context, - ServerReaderWriter* - stream) GRPC_OVERRIDE { + Status StreamingCall( + ServerContext* context, + ServerReaderWriter* stream) GRPC_OVERRIDE { SimpleRequest request; while (stream->Read(&request)) { SimpleResponse response; if (request.response_size() > 0) { - if (!Server::SetPayload(request.response_type(), - request.response_size(), - response.mutable_payload())) { - return Status(grpc::StatusCode::INTERNAL, "Error creating payload."); - } + if (!Server::SetPayload(request.response_type(), + request.response_size(), + response.mutable_payload())) { + return Status(grpc::StatusCode::INTERNAL, "Error creating payload."); + } } stream->Write(response); } diff --git a/test/cpp/qps/worker.cc b/test/cpp/qps/worker.cc index 281c617382a..25b12e09483 100644 --- a/test/cpp/qps/worker.cc +++ b/test/cpp/qps/worker.cc @@ -47,7 +47,7 @@ DEFINE_int32(server_port, 0, "Spawned server port."); static bool got_sigint = false; -static void sigint_handler(int x) {got_sigint = true;} +static void sigint_handler(int x) { got_sigint = true; } namespace grpc { namespace testing { @@ -69,6 +69,6 @@ int main(int argc, char** argv) { signal(SIGINT, sigint_handler); grpc::testing::RunServer(); - + return 0; }