aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/grpcpp/impl/codegen/call_op_set.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/call_op_set.h
parent6e5eb4e5a3276273d5cf6deb51b1835990ffea0f (diff)
parent6de81f54bbba10caa79fc72a253c0ea53fa05273 (diff)
Merge branch 'master' into failhijackedrecv
Diffstat (limited to 'include/grpcpp/impl/codegen/call_op_set.h')
-rw-r--r--include/grpcpp/impl/codegen/call_op_set.h23
1 files changed, 20 insertions, 3 deletions
diff --git a/include/grpcpp/impl/codegen/call_op_set.h b/include/grpcpp/impl/codegen/call_op_set.h
index b8a1c79ddf..1c75560c04 100644
--- a/include/grpcpp/impl/codegen/call_op_set.h
+++ b/include/grpcpp/impl/codegen/call_op_set.h
@@ -326,21 +326,37 @@ class CallOpSendMessage {
// Flags are per-message: clear them after use.
write_options_.Clear();
}
- void FinishOp(bool* status) { send_buf_.Clear(); }
+ void FinishOp(bool* status) {
+ if (!send_buf_.Valid()) {
+ return;
+ }
+ if (hijacked_ && failed_send_) {
+ // Hijacking interceptor failed this Op
+ *status = false;
+ } else if (!*status) {
+ // This Op was passed down to core and the Op failed
+ failed_send_ = true;
+ }
+ }
void SetInterceptionHookPoint(
InterceptorBatchMethodsImpl* interceptor_methods) {
if (!send_buf_.Valid()) return;
interceptor_methods->AddInterceptionHookPoint(
experimental::InterceptionHookPoints::PRE_SEND_MESSAGE);
- interceptor_methods->SetSendMessage(&send_buf_, msg_);
+ interceptor_methods->SetSendMessage(&send_buf_, msg_, &failed_send_);
}
void SetFinishInterceptionHookPoint(
InterceptorBatchMethodsImpl* interceptor_methods) {
+ if (send_buf_.Valid()) {
+ interceptor_methods->AddInterceptionHookPoint(
+ experimental::InterceptionHookPoints::POST_SEND_MESSAGE);
+ }
+ send_buf_.Clear();
// The contents of the SendMessage value that was previously set
// has had its references stolen by core's operations
- interceptor_methods->SetSendMessage(nullptr, nullptr);
+ interceptor_methods->SetSendMessage(nullptr, nullptr, &failed_send_);
}
void SetHijackingState(InterceptorBatchMethodsImpl* interceptor_methods) {
@@ -350,6 +366,7 @@ class CallOpSendMessage {
private:
const void* msg_ = nullptr; // The original non-serialized message
bool hijacked_ = false;
+ bool failed_send_ = false;
ByteBuffer send_buf_;
WriteOptions write_options_;
};