Reviewer comments

pull/22746/head
Yash Tibrewal 5 years ago
parent edbae5d8e6
commit e714d0fcb8
  1. 20
      include/grpcpp/impl/codegen/call_op_set.h
  2. 8
      include/grpcpp/impl/codegen/interceptor_common.h

@ -453,8 +453,12 @@ class CallOpRecvMessage {
recv_buf_.Clear();
}
} else if (hijacked_) {
if (!hijacked_recv_message_status_) {
if (hijacked_recv_message_failed_) {
FinishOpRecvMessageFailureHandler(status);
} else {
// The op was hijacked and it was successful. There is no further action
// to be performed since the message is already in its non-serialized
// form.
}
} else {
FinishOpRecvMessageFailureHandler(status);
@ -465,7 +469,7 @@ class CallOpRecvMessage {
InterceptorBatchMethodsImpl* interceptor_methods) {
if (message_ == nullptr) return;
interceptor_methods->SetRecvMessage(message_,
&hijacked_recv_message_status_);
&hijacked_recv_message_failed_);
}
void SetFinishInterceptionHookPoint(
@ -496,7 +500,7 @@ class CallOpRecvMessage {
ByteBuffer recv_buf_;
bool allow_not_getting_message_ = false;
bool hijacked_ = false;
bool hijacked_recv_message_status_ = true;
bool hijacked_recv_message_failed_ = false;
};
class DeserializeFunc {
@ -559,8 +563,12 @@ class CallOpGenericRecvMessage {
recv_buf_.Clear();
}
} else if (hijacked_) {
if (!hijacked_recv_message_status_) {
if (hijacked_recv_message_failed_) {
FinishOpRecvMessageFailureHandler(status);
} else {
// The op was hijacked and it was successful. There is no further action
// to be performed since the message is already in its non-serialized
// form.
}
} else {
got_message = false;
@ -574,7 +582,7 @@ class CallOpGenericRecvMessage {
InterceptorBatchMethodsImpl* interceptor_methods) {
if (!deserialize_) return;
interceptor_methods->SetRecvMessage(message_,
&hijacked_recv_message_status_);
&hijacked_recv_message_failed_);
}
void SetFinishInterceptionHookPoint(
@ -607,7 +615,7 @@ class CallOpGenericRecvMessage {
ByteBuffer recv_buf_;
bool allow_not_getting_message_ = false;
bool hijacked_ = false;
bool hijacked_recv_message_status_ = true;
bool hijacked_recv_message_failed_ = false;
};
class CallOpClientSendClose {

@ -166,9 +166,9 @@ class InterceptorBatchMethodsImpl
send_trailing_metadata_ = metadata;
}
void SetRecvMessage(void* message, bool* hijacked_recv_message_status) {
void SetRecvMessage(void* message, bool* hijacked_recv_message_failed) {
recv_message_ = message;
hijacked_recv_message_status_ = hijacked_recv_message_status;
hijacked_recv_message_failed_ = hijacked_recv_message_failed;
}
void SetRecvInitialMetadata(MetadataMap* map) {
@ -195,7 +195,7 @@ class InterceptorBatchMethodsImpl
void FailHijackedRecvMessage() override {
GPR_CODEGEN_ASSERT(hooks_[static_cast<size_t>(
experimental::InterceptionHookPoints::PRE_RECV_MESSAGE)]);
*hijacked_recv_message_status_ = false;
*hijacked_recv_message_failed_ = true;
}
// Clears all state
@ -407,7 +407,7 @@ class InterceptorBatchMethodsImpl
std::multimap<grpc::string, grpc::string>* send_trailing_metadata_ = nullptr;
void* recv_message_ = nullptr;
bool* hijacked_recv_message_status_ = nullptr;
bool* hijacked_recv_message_failed_ = nullptr;
MetadataMap* recv_initial_metadata_ = nullptr;

Loading…
Cancel
Save