aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/cpp
diff options
context:
space:
mode:
authorGravatar Sree Kuchibhotla <sreek@google.com>2017-03-03 02:19:31 -0800
committerGravatar Sree Kuchibhotla <sreek@google.com>2017-03-03 02:19:31 -0800
commit982a6f2b1c8ca5ec6d361776fc76472ef6728253 (patch)
treea123720eedcd6f3c5da76e20479ac0a3a21b3e27 /src/cpp
parent6b45d012466025c227eead4cf2c9f5abe28ea0dc (diff)
C++ code changes in response to grpc_completion_queue_create() API change
Diffstat (limited to 'src/cpp')
-rw-r--r--src/cpp/common/core_codegen.cc4
-rw-r--r--src/cpp/server/server_cc.cc19
2 files changed, 18 insertions, 5 deletions
diff --git a/src/cpp/common/core_codegen.cc b/src/cpp/common/core_codegen.cc
index 36e4c89354..81b32938b8 100644
--- a/src/cpp/common/core_codegen.cc
+++ b/src/cpp/common/core_codegen.cc
@@ -55,8 +55,10 @@ struct grpc_byte_buffer;
namespace grpc {
grpc_completion_queue* CoreCodegen::grpc_completion_queue_create(
+ grpc_cq_completion_type completion_type, grpc_cq_polling_type polling_type,
void* reserved) {
- return ::grpc_completion_queue_create(reserved);
+ return ::grpc_completion_queue_create(completion_type, polling_type,
+ reserved);
}
void CoreCodegen::grpc_completion_queue_destroy(grpc_completion_queue* cq) {
diff --git a/src/cpp/server/server_cc.cc b/src/cpp/server/server_cc.cc
index 9e11a8a9e0..1b7ca82be0 100644
--- a/src/cpp/server/server_cc.cc
+++ b/src/cpp/server/server_cc.cc
@@ -124,6 +124,14 @@ class ShutdownTag : public CompletionQueueTag {
bool FinalizeResult(void** tag, bool* status) { return false; }
};
+class DummyTag : public CompletionQueueTag {
+ public:
+ bool FinalizeResult(void** tag, bool* status) {
+ *status = true;
+ return true;
+ }
+};
+
class Server::SyncRequest final : public CompletionQueueTag {
public:
SyncRequest(RpcServiceMethod* method, void* tag)
@@ -145,7 +153,10 @@ class Server::SyncRequest final : public CompletionQueueTag {
grpc_metadata_array_destroy(&request_metadata_);
}
- void SetupRequest() { cq_ = grpc_completion_queue_create(nullptr); }
+ void SetupRequest() {
+ // TODO: sreek - Double check if this should be GRPC_CQ_PLUCK
+ cq_ = grpc_completion_queue_create(GRPC_CQ_PLUCK, DEFAULT_POLLING, nullptr);
+ }
void TeardownRequest() {
grpc_completion_queue_destroy(cq_);
@@ -213,10 +224,10 @@ class Server::SyncRequest final : public CompletionQueueTag {
MethodHandler::HandlerParameter(&call_, &ctx_, request_payload_));
global_callbacks->PostSynchronousRequest(&ctx_);
request_payload_ = nullptr;
- void* ignored_tag;
- bool ignored_ok;
+ DummyTag ignored_tag;
cq_.Shutdown();
- GPR_ASSERT(cq_.Next(&ignored_tag, &ignored_ok) == false);
+ /* Ensure the cq_ is shutdown (else this will hang indefinitely) */
+ GPR_ASSERT(cq_.Pluck(&ignored_tag) == false);
}
private: