diff --git a/test/cpp/qps/client_async.cc b/test/cpp/qps/client_async.cc index 8cb11b89c4d..9ea9cfe8b9b 100644 --- a/test/cpp/qps/client_async.cc +++ b/test/cpp/qps/client_async.cc @@ -98,7 +98,7 @@ class ClientRpcContext { public: ClientRpcContext() {} virtual ~ClientRpcContext() {} - virtual bool operator()() = 0; // do next state, return false if steps done + virtual bool RunNextState() = 0; // do next state, return false if steps done static void *tag(ClientRpcContext *c) { return reinterpret_cast(c); } static ClientRpcContext *detag(void *t) { return reinterpret_cast(t); @@ -126,7 +126,7 @@ class ClientRpcContextUnaryImpl : public ClientRpcContext { response_reader_( start_req(stub_, &context_, req_, ClientRpcContext::tag(this))) {} ~ClientRpcContextUnaryImpl() GRPC_OVERRIDE {} - bool operator()() GRPC_OVERRIDE { return (this->*next_state_)(); } + bool RunNextState() GRPC_OVERRIDE { return (this->*next_state_)(); } void report_stats(gpr_histogram *hist) GRPC_OVERRIDE { gpr_histogram_add(hist, now() - start_); } @@ -242,18 +242,19 @@ static void RunTest(const int client_threads, const int client_channels, cli_cq.Next(&got_tag, &ok); if (!ok) break; ClientRpcContext *ctx = ClientRpcContext::detag(got_tag); - if ((*ctx)() == false) { + if (ctx->RunNextState() == false) { // call the callback and then delete it - (*ctx)(); + ctx->report_stats(hist); + ctx->RunNextState(); delete ctx; } cli_cq.Next(&got_tag, &ok); if (!ok) break; ctx = ClientRpcContext::detag(got_tag); - if ((*ctx)() == false) { + if (ctx->RunNextState() == false) { // call the callback and then delete it ctx->report_stats(hist); - (*ctx)(); + ctx->RunNextState(); delete ctx; } // Now do runtime round-robin assignment of the next diff --git a/test/cpp/qps/server_async.cc b/test/cpp/qps/server_async.cc index 67452294f98..fc2459c1a50 100644 --- a/test/cpp/qps/server_async.cc +++ b/test/cpp/qps/server_async.cc @@ -155,7 +155,7 @@ class AsyncQpsServerTest { EXPECT_EQ(ok, true); ServerRpcContext *ctx = detag(got_tag); // The tag is a pointer to an RPC context to invoke - if ((*ctx)() == false) { + if (ctx->RunNextState() == false) { // this RPC context is done, so refresh it ctx->refresh(); } @@ -173,7 +173,7 @@ class AsyncQpsServerTest { public: ServerRpcContext() {} virtual ~ServerRpcContext(){}; - virtual bool operator()() = 0; // do next state, return false if all done + virtual bool RunNextState() = 0;// do next state, return false if all done virtual void refresh() = 0; // start this back at a clean state }; static void *tag(ServerRpcContext *func) { @@ -200,7 +200,7 @@ class AsyncQpsServerTest { AsyncQpsServerTest::tag(this)); } ~ServerRpcContextUnaryImpl() GRPC_OVERRIDE {} - bool operator()() GRPC_OVERRIDE { return (this->*next_state_)(); } + bool RunNextState() GRPC_OVERRIDE { return (this->*next_state_)(); } void refresh() GRPC_OVERRIDE { srv_ctx_ = ServerContext(); req_ = RequestType();