diff options
author | Vijay Pai <vpai@google.com> | 2017-03-29 15:47:30 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-29 15:47:30 -0700 |
commit | c7cbbaf80f4658165142c7f7d13c0ae0dfe368b2 (patch) | |
tree | 307ec584e5658b06bff76e09eb249c36c3829485 /test/cpp | |
parent | 43d845080bbdd39fcd6a000a52c896091f210693 (diff) | |
parent | 0ff932cf080ba0f73bec20919dfd295a144fd75c (diff) |
Merge pull request #10331 from vjpai/async
Make sure that we hold contents of async operation until completion
Diffstat (limited to 'test/cpp')
-rw-r--r-- | test/cpp/qps/server_async.cc | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/test/cpp/qps/server_async.cc b/test/cpp/qps/server_async.cc index b58d91eea6..b499b82091 100644 --- a/test/cpp/qps/server_async.cc +++ b/test/cpp/qps/server_async.cc @@ -235,18 +235,17 @@ class AsyncQpsServerTest final : public grpc::testing::Server { return false; } - ResponseType response; - // Call the RPC processing function - grpc::Status status = invoke_method_(&req_, &response); + grpc::Status status = invoke_method_(&req_, &response_); // Have the response writer work and invoke on_finish when done next_state_ = &ServerRpcContextUnaryImpl::finisher; - response_writer_.Finish(response, status, AsyncQpsServerTest::tag(this)); + response_writer_.Finish(response_, status, AsyncQpsServerTest::tag(this)); return true; } std::unique_ptr<ServerContextType> srv_ctx_; RequestType req_; + ResponseType response_; bool (ServerRpcContextUnaryImpl::*next_state_)(bool); std::function<void(ServerContextType *, RequestType *, grpc::ServerAsyncResponseWriter<ResponseType> *, void *)> @@ -298,11 +297,10 @@ class AsyncQpsServerTest final : public grpc::testing::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); + grpc::Status status = invoke_method_(&req_, &response_); // initiate the write - stream_.Write(response, AsyncQpsServerTest::tag(this)); + stream_.Write(response_, AsyncQpsServerTest::tag(this)); next_state_ = &ServerRpcContextStreamingImpl::write_done; } else { // client has sent writes done // finish the stream @@ -326,6 +324,7 @@ class AsyncQpsServerTest final : public grpc::testing::Server { std::unique_ptr<ServerContextType> srv_ctx_; RequestType req_; + ResponseType response_; bool (ServerRpcContextStreamingImpl::*next_state_)(bool); std::function<void( ServerContextType *, |