diff options
author | 2015-05-26 15:31:01 -0700 | |
---|---|---|
committer | 2015-05-26 15:31:01 -0700 | |
commit | c5902879d8b305f5e8b3339fdb2e1906f58beaa9 (patch) | |
tree | e48b94cdf4f43282aeab5a4cb21df2030b8226cd /test/cpp | |
parent | f01ccb7ba3a332b60b734e360d43f1f893177e34 (diff) | |
parent | d679eb9498cfd673877c8526760591a99fc8bc4a (diff) |
Merge branch 'master' of github.com:grpc/grpc into qps_reporter_refactoring
Diffstat (limited to 'test/cpp')
-rw-r--r-- | test/cpp/qps/server_async.cc | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/test/cpp/qps/server_async.cc b/test/cpp/qps/server_async.cc index 58499f345f..b9998405f6 100644 --- a/test/cpp/qps/server_async.cc +++ b/test/cpp/qps/server_async.cc @@ -99,12 +99,15 @@ class AsyncQpsServerTest : public Server { while (srv_cq_->Next(&got_tag, &ok)) { ServerRpcContext *ctx = detag(got_tag); // The tag is a pointer to an RPC context to invoke - if (ctx->RunNextState(ok) == false) { + bool still_going = ctx->RunNextState(ok); + std::lock_guard<std::mutex> g(shutdown_mutex_); + if (!shutdown_) { // this RPC context is done, so refresh it - std::lock_guard<std::mutex> g(shutdown_mutex_); - if (!shutdown_) { + if (!still_going) { ctx->Reset(); } + } else { + return; } } return; @@ -116,11 +119,15 @@ class AsyncQpsServerTest : public Server { { std::lock_guard<std::mutex> g(shutdown_mutex_); shutdown_ = true; - srv_cq_->Shutdown(); } for (auto thr = threads_.begin(); thr != threads_.end(); thr++) { thr->join(); } + srv_cq_->Shutdown(); + bool ok; + void *got_tag; + while (srv_cq_->Next(&got_tag, &ok)) + ; while (!contexts_.empty()) { delete contexts_.front(); contexts_.pop_front(); |