diff options
author | Yash Tibrewal <yashkt@google.com> | 2018-11-15 15:57:43 -0800 |
---|---|---|
committer | Yash Tibrewal <yashkt@google.com> | 2018-11-15 15:57:43 -0800 |
commit | d4ebd30eb2eb94f77ac9b52c44880e3d70c6aef0 (patch) | |
tree | a68044af8cf5dd699d9de7c13160d1c4b9aef482 /include/grpcpp/impl/codegen/call_op_set.h | |
parent | 5d7d6c0fbdcac75ea482e1fde3e128cd0c1646c1 (diff) |
Add method to get status of send message op on POST_SEND_MESSAGE
Diffstat (limited to 'include/grpcpp/impl/codegen/call_op_set.h')
-rw-r--r-- | include/grpcpp/impl/codegen/call_op_set.h | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/include/grpcpp/impl/codegen/call_op_set.h b/include/grpcpp/impl/codegen/call_op_set.h index 1f2b88e9e1..f330679ffc 100644 --- a/include/grpcpp/impl/codegen/call_op_set.h +++ b/include/grpcpp/impl/codegen/call_op_set.h @@ -315,9 +315,16 @@ class CallOpSendMessage { write_options_.Clear(); } void FinishOp(bool* status) { - send_buf_.Clear(); + 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 + gpr_log(GPR_ERROR, "failure status"); + failed_send_ = true; } } @@ -330,7 +337,14 @@ class CallOpSendMessage { } void SetFinishInterceptionHookPoint( - InterceptorBatchMethodsImpl* interceptor_methods) {} + InterceptorBatchMethodsImpl* interceptor_methods) { + if (send_buf_.Valid()) { + interceptor_methods->AddInterceptionHookPoint( + experimental::InterceptionHookPoints::POST_SEND_MESSAGE); + // We had already registered failed_send_ earlier. No need to do it again. + } + send_buf_.Clear(); + } void SetHijackingState(InterceptorBatchMethodsImpl* interceptor_methods) { hijacked_ = true; |