diff options
author | Yash Tibrewal <yashkt@google.com> | 2018-11-14 17:35:26 -0800 |
---|---|---|
committer | Yash Tibrewal <yashkt@google.com> | 2018-11-14 17:35:26 -0800 |
commit | 5d7d6c0fbdcac75ea482e1fde3e128cd0c1646c1 (patch) | |
tree | 385a643e866eaebf589b4ed3f5833bfe403d20d9 /include/grpcpp/impl/codegen/call_op_set.h | |
parent | 9cfacc48ee2e9f8db083d578c84881551734b1f0 (diff) |
Add method to fail hijacked send messages
Diffstat (limited to 'include/grpcpp/impl/codegen/call_op_set.h')
-rw-r--r-- | include/grpcpp/impl/codegen/call_op_set.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/include/grpcpp/impl/codegen/call_op_set.h b/include/grpcpp/impl/codegen/call_op_set.h index b4c34a01c9..1f2b88e9e1 100644 --- a/include/grpcpp/impl/codegen/call_op_set.h +++ b/include/grpcpp/impl/codegen/call_op_set.h @@ -314,14 +314,19 @@ class CallOpSendMessage { // Flags are per-message: clear them after use. write_options_.Clear(); } - void FinishOp(bool* status) { send_buf_.Clear(); } + void FinishOp(bool* status) { + send_buf_.Clear(); + if (hijacked_ && failed_send_) { + *status = false; + } + } void SetInterceptionHookPoint( InterceptorBatchMethodsImpl* interceptor_methods) { if (!send_buf_.Valid()) return; interceptor_methods->AddInterceptionHookPoint( experimental::InterceptionHookPoints::PRE_SEND_MESSAGE); - interceptor_methods->SetSendMessage(&send_buf_); + interceptor_methods->SetSendMessage(&send_buf_, &failed_send_); } void SetFinishInterceptionHookPoint( @@ -333,6 +338,7 @@ class CallOpSendMessage { private: bool hijacked_ = false; + bool failed_send_ = false; ByteBuffer send_buf_; WriteOptions write_options_; }; |