diff options
author | heretic <heretic@yandex-team.ru> | 2022-03-25 12:34:53 +0300 |
---|---|---|
committer | heretic <heretic@yandex-team.ru> | 2022-03-25 12:34:53 +0300 |
commit | a41f3739eed6fceb6f62056a7620d220958a47e7 (patch) | |
tree | 278103258b510cb4a96761ea79d6ccd397ca05a0 /contrib/libs/grpc/include/grpcpp/impl/codegen/server_callback_handlers.h | |
parent | 73d3613a82e5c217fcbe0ab8bbf8120c1ed1af55 (diff) | |
download | ydb-a41f3739eed6fceb6f62056a7620d220958a47e7.tar.gz |
Update grpc to 1.43.2 DTCC-864
ref:50a492c335cda70f458797cf945e49fe739c2715
Diffstat (limited to 'contrib/libs/grpc/include/grpcpp/impl/codegen/server_callback_handlers.h')
-rw-r--r-- | contrib/libs/grpc/include/grpcpp/impl/codegen/server_callback_handlers.h | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/contrib/libs/grpc/include/grpcpp/impl/codegen/server_callback_handlers.h b/contrib/libs/grpc/include/grpcpp/impl/codegen/server_callback_handlers.h index 76e655a9b3..8713d3eb30 100644 --- a/contrib/libs/grpc/include/grpcpp/impl/codegen/server_callback_handlers.h +++ b/contrib/libs/grpc/include/grpcpp/impl/codegen/server_callback_handlers.h @@ -18,6 +18,8 @@ #ifndef GRPCPP_IMPL_CODEGEN_SERVER_CALLBACK_HANDLERS_H #define GRPCPP_IMPL_CODEGEN_SERVER_CALLBACK_HANDLERS_H +// IWYU pragma: private + #include <grpcpp/impl/codegen/message_allocator.h> #include <grpcpp/impl/codegen/rpc_service_method.h> #include <grpcpp/impl/codegen/server_callback.h> @@ -37,17 +39,16 @@ class CallbackUnaryHandler : public ::grpc::internal::MethodHandler { : get_reactor_(std::move(get_reactor)) {} void SetMessageAllocator( - ::grpc::experimental::MessageAllocator<RequestType, ResponseType>* - allocator) { + MessageAllocator<RequestType, ResponseType>* allocator) { allocator_ = allocator; } void RunHandler(const HandlerParameter& param) final { // Arena allocate a controller structure (that includes request/response) ::grpc::g_core_codegen_interface->grpc_call_ref(param.call->call()); - auto* allocator_state = static_cast< - ::grpc::experimental::MessageHolder<RequestType, ResponseType>*>( - param.internal_data); + auto* allocator_state = + static_cast<MessageHolder<RequestType, ResponseType>*>( + param.internal_data); auto* call = new (::grpc::g_core_codegen_interface->grpc_call_arena_alloc( param.call->call(), sizeof(ServerCallbackUnaryImpl))) @@ -82,8 +83,7 @@ class CallbackUnaryHandler : public ::grpc::internal::MethodHandler { ::grpc::ByteBuffer buf; buf.set_buffer(req); RequestType* request = nullptr; - ::grpc::experimental::MessageHolder<RequestType, ResponseType>* - allocator_state = nullptr; + MessageHolder<RequestType, ResponseType>* allocator_state; if (allocator_ != nullptr) { allocator_state = allocator_->AllocateMessages(); } else { @@ -100,8 +100,6 @@ class CallbackUnaryHandler : public ::grpc::internal::MethodHandler { if (status->ok()) { return request; } - // Clean up on deserialization failure. - allocator_state->Release(); return nullptr; } @@ -109,8 +107,7 @@ class CallbackUnaryHandler : public ::grpc::internal::MethodHandler { std::function<ServerUnaryReactor*(::grpc::CallbackServerContext*, const RequestType*, ResponseType*)> get_reactor_; - ::grpc::experimental::MessageAllocator<RequestType, ResponseType>* - allocator_ = nullptr; + MessageAllocator<RequestType, ResponseType>* allocator_ = nullptr; class ServerCallbackUnaryImpl : public ServerCallbackUnary { public: @@ -181,8 +178,7 @@ class CallbackUnaryHandler : public ::grpc::internal::MethodHandler { ServerCallbackUnaryImpl( ::grpc::CallbackServerContext* ctx, ::grpc::internal::Call* call, - ::grpc::experimental::MessageHolder<RequestType, ResponseType>* - allocator_state, + MessageHolder<RequestType, ResponseType>* allocator_state, std::function<void()> call_requester) : ctx_(ctx), call_(*call), @@ -233,8 +229,7 @@ class CallbackUnaryHandler : public ::grpc::internal::MethodHandler { ::grpc::CallbackServerContext* const ctx_; ::grpc::internal::Call call_; - ::grpc::experimental::MessageHolder<RequestType, ResponseType>* const - allocator_state_; + MessageHolder<RequestType, ResponseType>* const allocator_state_; std::function<void()> call_requester_; // reactor_ can always be loaded/stored with relaxed memory ordering because // its value is only set once, independently of other data in the object, @@ -384,6 +379,9 @@ class CallbackClientStreamingHandler : public ::grpc::internal::MethodHandler { read_tag_.Set( call_.call(), [this, reactor](bool ok) { + if (GPR_UNLIKELY(!ok)) { + ctx_->MaybeMarkCancelledOnRead(); + } reactor->OnReadDone(ok); this->MaybeDone(/*inlineable_ondone=*/true); }, @@ -831,6 +829,9 @@ class CallbackBidiHandler : public ::grpc::internal::MethodHandler { read_tag_.Set( call_.call(), [this, reactor](bool ok) { + if (GPR_UNLIKELY(!ok)) { + ctx_->MaybeMarkCancelledOnRead(); + } reactor->OnReadDone(ok); this->MaybeDone(/*inlineable_ondone=*/true); }, |