aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar Yash Tibrewal <yashkt@google.com>2018-11-15 13:55:56 -0800
committerGravatar Yash Tibrewal <yashkt@google.com>2018-11-15 13:55:56 -0800
commit0911e489e3fe22e2ca5d7c927dac83358f2f05b7 (patch)
treef20fe0049cb0303e370e7a751416a8b2ea02521f /include
parentceeb28a360d48389edb8c1c91a1efac46e24a9b7 (diff)
Add a method to check whether the message was received successfully
Diffstat (limited to 'include')
-rw-r--r--include/grpcpp/impl/codegen/call_op_set.h6
-rw-r--r--include/grpcpp/impl/codegen/interceptor.h3
-rw-r--r--include/grpcpp/impl/codegen/interceptor_common.h10
3 files changed, 17 insertions, 2 deletions
diff --git a/include/grpcpp/impl/codegen/call_op_set.h b/include/grpcpp/impl/codegen/call_op_set.h
index aae8b9d3e3..3699ec94f2 100644
--- a/include/grpcpp/impl/codegen/call_op_set.h
+++ b/include/grpcpp/impl/codegen/call_op_set.h
@@ -406,12 +406,13 @@ class CallOpRecvMessage {
void SetInterceptionHookPoint(
InterceptorBatchMethodsImpl* interceptor_methods) {
+ if (message_ == nullptr) return;
interceptor_methods->SetRecvMessage(message_, &got_message);
}
void SetFinishInterceptionHookPoint(
InterceptorBatchMethodsImpl* interceptor_methods) {
- if (!got_message) return;
+ if (message_ == nullptr) return;
interceptor_methods->AddInterceptionHookPoint(
experimental::InterceptionHookPoints::POST_RECV_MESSAGE);
}
@@ -501,12 +502,13 @@ class CallOpGenericRecvMessage {
void SetInterceptionHookPoint(
InterceptorBatchMethodsImpl* interceptor_methods) {
+ if (!deserialize_) return;
interceptor_methods->SetRecvMessage(message_, &got_message);
}
void SetFinishInterceptionHookPoint(
InterceptorBatchMethodsImpl* interceptor_methods) {
- if (!got_message) return;
+ if (!deserialize_) return;
interceptor_methods->AddInterceptionHookPoint(
experimental::InterceptionHookPoints::POST_RECV_MESSAGE);
}
diff --git a/include/grpcpp/impl/codegen/interceptor.h b/include/grpcpp/impl/codegen/interceptor.h
index 943376a545..b977c35016 100644
--- a/include/grpcpp/impl/codegen/interceptor.h
+++ b/include/grpcpp/impl/codegen/interceptor.h
@@ -103,6 +103,9 @@ class InterceptorBatchMethods {
// is already deserialized
virtual void* GetRecvMessage() = 0;
+ // Checks whether the RECV MESSAGE op completed successfully
+ virtual bool GetRecvMessageStatus() = 0;
+
// Returns a modifiable multimap of the received initial metadata
virtual std::multimap<grpc::string_ref, grpc::string_ref>*
GetRecvInitialMetadata() = 0;
diff --git a/include/grpcpp/impl/codegen/interceptor_common.h b/include/grpcpp/impl/codegen/interceptor_common.h
index d23b71f8a7..b2e92dd6f3 100644
--- a/include/grpcpp/impl/codegen/interceptor_common.h
+++ b/include/grpcpp/impl/codegen/interceptor_common.h
@@ -103,6 +103,8 @@ class InterceptorBatchMethodsImpl
void* GetRecvMessage() override { return recv_message_; }
+ bool GetRecvMessageStatus() override { return *got_message_; }
+
std::multimap<grpc::string_ref, grpc::string_ref>* GetRecvInitialMetadata()
override {
return recv_initial_metadata_->map();
@@ -432,6 +434,14 @@ class CancelInterceptorBatchMethods
return nullptr;
}
+ bool GetRecvMessageStatus() override {
+ GPR_CODEGEN_ASSERT(
+ false &&
+ "It is illegal to call GetRecvMessageStatus on a method which "
+ "has a Cancel notification");
+ return false;
+ }
+
std::multimap<grpc::string_ref, grpc::string_ref>* GetRecvInitialMetadata()
override {
GPR_CODEGEN_ASSERT(false &&