diff options
Diffstat (limited to 'test/cpp/qps/client_sync.cc')
-rw-r--r-- | test/cpp/qps/client_sync.cc | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/test/cpp/qps/client_sync.cc b/test/cpp/qps/client_sync.cc index 947618121b..aea5a0fb27 100644 --- a/test/cpp/qps/client_sync.cc +++ b/test/cpp/qps/client_sync.cc @@ -83,13 +83,14 @@ class SynchronousUnaryClient GRPC_FINAL : public SynchronousClient { SynchronousClient(config) {StartThreads(num_threads_);} ~SynchronousUnaryClient() {} - void ThreadFunc(Histogram* histogram, size_t thread_idx) GRPC_OVERRIDE { + bool ThreadFunc(Histogram* histogram, size_t thread_idx) GRPC_OVERRIDE { auto* stub = channels_[thread_idx % channels_.size()].get_stub(); double start = Timer::Now(); grpc::ClientContext context; grpc::Status s = stub->UnaryCall(&context, request_, &responses_[thread_idx]); histogram->Add((Timer::Now() - start) * 1e9); + return s.IsOk(); } }; @@ -111,11 +112,13 @@ class SynchronousStreamingClient GRPC_FINAL : public SynchronousClient { } } - void ThreadFunc(Histogram* histogram, size_t thread_idx) GRPC_OVERRIDE { + bool ThreadFunc(Histogram* histogram, size_t thread_idx) GRPC_OVERRIDE { double start = Timer::Now(); - EXPECT_TRUE(stream_->Write(request_)); - EXPECT_TRUE(stream_->Read(&responses_[thread_idx])); - histogram->Add((Timer::Now() - start) * 1e9); + if (stream_->Write(request_) && stream_->Read(&responses_[thread_idx])) { + histogram->Add((Timer::Now() - start) * 1e9); + return true; + } + return false; } private: grpc::ClientContext context_; |