diff options
author | 2018-10-10 23:26:44 -0700 | |
---|---|---|
committer | 2018-10-16 14:10:17 -0700 | |
commit | 6f05a711e651196672450693493dee181368697d (patch) | |
tree | 451d6c4f66fb4400c6970af21e3690f73227ce4c /include/grpcpp | |
parent | 63bdf4e2363a3c55edf8ddb9d089da88c31963f2 (diff) |
Adding a test
Diffstat (limited to 'include/grpcpp')
-rw-r--r-- | include/grpcpp/impl/codegen/call.h | 13 | ||||
-rw-r--r-- | include/grpcpp/impl/codegen/completion_queue.h | 19 |
2 files changed, 18 insertions, 14 deletions
diff --git a/include/grpcpp/impl/codegen/call.h b/include/grpcpp/impl/codegen/call.h index b2f133a94e..1f9128d8db 100644 --- a/include/grpcpp/impl/codegen/call.h +++ b/include/grpcpp/impl/codegen/call.h @@ -19,6 +19,7 @@ #ifndef GRPCPP_IMPL_CODEGEN_CALL_H #define GRPCPP_IMPL_CODEGEN_CALL_H +#include <array> #include <assert.h> #include <cstring> #include <functional> @@ -412,7 +413,7 @@ class CallOpRecvMessage { void SetFinishInterceptionHookPoint( experimental::InterceptorBatchMethods* interceptor_methods) { - if (message_ == nullptr || !got_message) return; + if (!got_message) return; interceptor_methods->AddInterceptionHookPoint( experimental::InterceptionHookPoints::POST_RECV_MESSAGE); } @@ -507,7 +508,7 @@ class CallOpGenericRecvMessage { void SetFinishInterceptionHookPoint( experimental::InterceptorBatchMethods* interceptor_methods) { - if (!deserialize_ || !got_message) return; + if (!got_message) return; interceptor_methods->AddInterceptionHookPoint( experimental::InterceptionHookPoints::POST_RECV_MESSAGE); } @@ -651,7 +652,6 @@ class CallOpRecvInitialMetadata { void FinishOp(bool* status) { if (metadata_map_ == nullptr || hijacked_) return; - metadata_map_ = nullptr; } void SetInterceptionHookPoint( @@ -662,6 +662,7 @@ class CallOpRecvInitialMetadata { if (metadata_map_ == nullptr) return; interceptor_methods->AddInterceptionHookPoint( experimental::InterceptionHookPoints::POST_RECV_INITIAL_METADATA); + metadata_map_ = nullptr; } void SetHijackingState( @@ -719,7 +720,6 @@ class CallOpClientRecvStatus { if (debug_error_string_ != nullptr) { g_core_codegen_interface->gpr_free((void*)debug_error_string_); } - recv_status_ = nullptr; } void SetInterceptionHookPoint( @@ -732,6 +732,7 @@ class CallOpClientRecvStatus { experimental::InterceptionHookPoints::POST_RECV_STATUS); interceptor_methods->SetRecvStatus(recv_status_); interceptor_methods->SetRecvTrailingMetadata(metadata_map_->arr()); + recv_status_ = nullptr; } void SetHijackingState( @@ -912,7 +913,7 @@ class InterceptorBatchMethodsImpl virtual void AddInterceptionHookPoint( experimental::InterceptionHookPoints type) override { - hooks_[static_cast<int>(type)]; + hooks_[static_cast<int>(type)] = true; } virtual void GetSendMessage(grpc_byte_buffer** buf) override { @@ -1187,13 +1188,13 @@ class CallOpSet : public CallOpSetInterface, } /* Returns true if no interceptors need to be run */ bool RunInterceptorsPostRecv() { + interceptor_methods_.SetReverse(); this->Op1::SetFinishInterceptionHookPoint(&interceptor_methods_); this->Op2::SetFinishInterceptionHookPoint(&interceptor_methods_); this->Op3::SetFinishInterceptionHookPoint(&interceptor_methods_); this->Op4::SetFinishInterceptionHookPoint(&interceptor_methods_); this->Op5::SetFinishInterceptionHookPoint(&interceptor_methods_); this->Op6::SetFinishInterceptionHookPoint(&interceptor_methods_); - interceptor_methods_.SetReverse(); return interceptor_methods_.RunInterceptors(); } diff --git a/include/grpcpp/impl/codegen/completion_queue.h b/include/grpcpp/impl/codegen/completion_queue.h index f52f9a53be..34c2a477ae 100644 --- a/include/grpcpp/impl/codegen/completion_queue.h +++ b/include/grpcpp/impl/codegen/completion_queue.h @@ -299,14 +299,17 @@ class CompletionQueue : private GrpcLibraryCodegen { bool Pluck(internal::CompletionQueueTag* tag) { auto deadline = g_core_codegen_interface->gpr_inf_future(GPR_CLOCK_REALTIME); - auto ev = g_core_codegen_interface->grpc_completion_queue_pluck( - cq_, tag, deadline, nullptr); - bool ok = ev.success != 0; - void* ignored = tag; - GPR_CODEGEN_ASSERT(tag->FinalizeResult(&ignored, &ok)); - GPR_CODEGEN_ASSERT(ignored == tag); - // Ignore mutations by FinalizeResult: Pluck returns the C API status - return ev.success != 0; + while (true) { + auto ev = g_core_codegen_interface->grpc_completion_queue_pluck( + cq_, tag, deadline, nullptr); + bool ok = ev.success != 0; + void* ignored = tag; + if (tag->FinalizeResult(&ignored, &ok)) { + GPR_CODEGEN_ASSERT(ignored == tag); + // Ignore mutations by FinalizeResult: Pluck returns the C API status + return ev.success != 0; + } + } } /// Performs a single polling pluck on \a tag. |