aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/grpcpp/impl/codegen/interceptor_common.h
diff options
context:
space:
mode:
authorGravatar Yash Tibrewal <yashkt@google.com>2019-01-04 17:28:25 -0800
committerGravatar Yash Tibrewal <yashkt@google.com>2019-01-04 17:28:25 -0800
commit059459a9ee082538d79be65dda3a131ef634cef1 (patch)
treef375e509e895f0d11888c930d44fdaee6f62b8cb /include/grpcpp/impl/codegen/interceptor_common.h
parent6e5eb4e5a3276273d5cf6deb51b1835990ffea0f (diff)
parent6de81f54bbba10caa79fc72a253c0ea53fa05273 (diff)
Merge branch 'master' into failhijackedrecv
Diffstat (limited to 'include/grpcpp/impl/codegen/interceptor_common.h')
-rw-r--r--include/grpcpp/impl/codegen/interceptor_common.h27
1 files changed, 26 insertions, 1 deletions
diff --git a/include/grpcpp/impl/codegen/interceptor_common.h b/include/grpcpp/impl/codegen/interceptor_common.h
index d60f9585fc..345127c830 100644
--- a/include/grpcpp/impl/codegen/interceptor_common.h
+++ b/include/grpcpp/impl/codegen/interceptor_common.h
@@ -83,6 +83,8 @@ class InterceptorBatchMethodsImpl
const void* GetSendMessage() override { return orig_send_message_; }
+ bool GetSendMessageStatus() override { return !*fail_send_message_; }
+
std::multimap<grpc::string, grpc::string>* GetSendInitialMetadata() override {
return send_initial_metadata_;
}
@@ -112,14 +114,22 @@ class InterceptorBatchMethodsImpl
Status* GetRecvStatus() override { return recv_status_; }
+ void FailHijackedSendMessage() override {
+ GPR_CODEGEN_ASSERT(hooks_[static_cast<size_t>(
+ experimental::InterceptionHookPoints::PRE_SEND_MESSAGE)]);
+ *fail_send_message_ = true;
+ }
+
std::multimap<grpc::string_ref, grpc::string_ref>* GetRecvTrailingMetadata()
override {
return recv_trailing_metadata_->map();
}
- void SetSendMessage(ByteBuffer* buf, const void* msg) {
+ void SetSendMessage(ByteBuffer* buf, const void* msg,
+ bool* fail_send_message) {
send_message_ = buf;
orig_send_message_ = msg;
+ fail_send_message_ = fail_send_message;
}
void SetSendInitialMetadata(
@@ -348,6 +358,7 @@ class InterceptorBatchMethodsImpl
std::function<void(void)> callback_;
ByteBuffer* send_message_ = nullptr;
+ bool* fail_send_message_ = nullptr;
const void* orig_send_message_ = nullptr;
std::multimap<grpc::string, grpc::string>* send_initial_metadata_;
@@ -402,6 +413,14 @@ class CancelInterceptorBatchMethods
return nullptr;
}
+ bool GetSendMessageStatus() override {
+ GPR_CODEGEN_ASSERT(
+ false &&
+ "It is illegal to call GetSendMessageStatus on a method which "
+ "has a Cancel notification");
+ return false;
+ }
+
const void* GetSendMessage() override {
GPR_CODEGEN_ASSERT(
false &&
@@ -481,6 +500,12 @@ class CancelInterceptorBatchMethods
"It is illegal to call FailHijackedRecvMessage on a "
"method which has a Cancel notification");
}
+
+ void FailHijackedSendMessage() override {
+ GPR_CODEGEN_ASSERT(false &&
+ "It is illegal to call FailHijackedSendMessage on a "
+ "method which has a Cancel notification");
+ }
};
} // namespace internal
} // namespace grpc