diff options
author | 2015-04-09 12:08:44 -0700 | |
---|---|---|
committer | 2015-04-09 12:08:44 -0700 | |
commit | 1c61af73643fff22f7e0dda08d73b812ffffcb9f (patch) | |
tree | 19b6e7027b505eb3f95de9859d9ddee470d6d1d7 | |
parent | 8a5a666ad03b158a32dee787166d7127eedd929c (diff) |
Dont sleep forever on async cq
-rw-r--r-- | test/cpp/qps/client_async.cc | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/test/cpp/qps/client_async.cc b/test/cpp/qps/client_async.cc index fecff5c8ce..8b0619d5fc 100644 --- a/test/cpp/qps/client_async.cc +++ b/test/cpp/qps/client_async.cc @@ -176,7 +176,11 @@ class AsyncUnaryClient GRPC_FINAL : public Client { bool ThreadFunc(Histogram* histogram, size_t thread_idx) GRPC_OVERRIDE { void* got_tag; bool ok; - cli_cqs_[thread_idx]->Next(&got_tag, &ok); + switch (cli_cqs_[thread_idx]->AsyncNext(&got_tag, &ok, std::chrono::system_clock::now() + std::chrono::seconds(11))) { + case CompletionQueue::SHUTDOWN: return false; + case CompletionQueue::TIMEOUT: return true; + case CompletionQueue::GOT_EVENT: break; + } ClientRpcContext* ctx = ClientRpcContext::detag(got_tag); if (ctx->RunNextState(ok, histogram) == false) { @@ -306,7 +310,11 @@ class AsyncStreamingClient GRPC_FINAL : public Client { bool ThreadFunc(Histogram *histogram, size_t thread_idx) GRPC_OVERRIDE { void *got_tag; bool ok; - cli_cqs_[thread_idx]->Next(&got_tag, &ok); + switch (cli_cqs_[thread_idx]->AsyncNext(&got_tag, &ok, std::chrono::system_clock::now() + std::chrono::seconds(11))) { + case CompletionQueue::SHUTDOWN: return false; + case CompletionQueue::TIMEOUT: return true; + case CompletionQueue::GOT_EVENT: break; + } ClientRpcContext *ctx = ClientRpcContext::detag(got_tag); if (ctx->RunNextState(ok, histogram) == false) { |