aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/cpp
diff options
context:
space:
mode:
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..50c4cafa7a 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() {
+ cq_ = grpc_completion_queue_create(GRPC_CQ_PLUCK, GRPC_CQ_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: