aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cpp
diff options
context:
space:
mode:
authorGravatar Yuchen Zeng <y-zeng@users.noreply.github.com>2016-10-05 13:39:02 -0700
committerGravatar GitHub <noreply@github.com>2016-10-05 13:39:02 -0700
commita2e50c5b85b4c0d4d7a5f9624eb40856198ef508 (patch)
treede2775003729a50fe795b18fb8920e1211400528 /test/cpp
parent998dbc0492a1c95cc895a3a8f723faaf815942e4 (diff)
parentd7c8c2bf947d620f257a00e1ce5c37aab3d50951 (diff)
Merge pull request #8190 from y-zeng/proto_db
Improve ProtoReflectionDescriptorDatabase
Diffstat (limited to 'test/cpp')
-rw-r--r--test/cpp/util/grpc_tool.cc1
-rw-r--r--test/cpp/util/proto_reflection_descriptor_database.cc9
-rw-r--r--test/cpp/util/proto_reflection_descriptor_database.h2
3 files changed, 7 insertions, 5 deletions
diff --git a/test/cpp/util/grpc_tool.cc b/test/cpp/util/grpc_tool.cc
index 8fb325cf76..03c33abe9f 100644
--- a/test/cpp/util/grpc_tool.cc
+++ b/test/cpp/util/grpc_tool.cc
@@ -52,7 +52,6 @@
#include "test/cpp/util/proto_file_parser.h"
#include "test/cpp/util/proto_reflection_descriptor_database.h"
#include "test/cpp/util/service_describer.h"
-#include "test/cpp/util/test_config.h"
namespace grpc {
namespace testing {
diff --git a/test/cpp/util/proto_reflection_descriptor_database.cc b/test/cpp/util/proto_reflection_descriptor_database.cc
index b60f447e37..54790be496 100644
--- a/test/cpp/util/proto_reflection_descriptor_database.cc
+++ b/test/cpp/util/proto_reflection_descriptor_database.cc
@@ -314,13 +314,16 @@ ProtoReflectionDescriptorDatabase::GetStream() {
return stream_;
}
-void ProtoReflectionDescriptorDatabase::DoOneRequest(
+bool ProtoReflectionDescriptorDatabase::DoOneRequest(
const ServerReflectionRequest& request,
ServerReflectionResponse& response) {
+ bool success = false;
stream_mutex_.lock();
- GetStream()->Write(request);
- GetStream()->Read(&response);
+ if (GetStream()->Write(request) && GetStream()->Read(&response)) {
+ success = true;
+ }
stream_mutex_.unlock();
+ return success;
}
} // namespace grpc
diff --git a/test/cpp/util/proto_reflection_descriptor_database.h b/test/cpp/util/proto_reflection_descriptor_database.h
index 471c9618da..dfa36044d9 100644
--- a/test/cpp/util/proto_reflection_descriptor_database.h
+++ b/test/cpp/util/proto_reflection_descriptor_database.h
@@ -111,7 +111,7 @@ class ProtoReflectionDescriptorDatabase : public protobuf::DescriptorDatabase {
const std::shared_ptr<ClientStream> GetStream();
- void DoOneRequest(
+ bool DoOneRequest(
const grpc::reflection::v1alpha::ServerReflectionRequest& request,
grpc::reflection::v1alpha::ServerReflectionResponse& response);