From be54f5db7bc0a6db47326446ccdf3d3d10311e97 Mon Sep 17 00:00:00 2001 From: Hannah Shi Date: Sun, 4 Aug 2024 11:58:52 -0700 Subject: [PATCH] Sync c-core 1.64.3 --- gRPC-C++.podspec | 4 +- gRPC-Core.podspec | 2 +- gRPC-ProtoRPC.podspec | 2 +- gRPC-RxLibrary.podspec | 2 +- gRPC.podspec | 2 +- include/grpcpp/client_context.h | 4 +- include/grpcpp/completion_queue.h | 8 +- include/grpcpp/impl/call_op_set.h | 17 ++-- include/grpcpp/impl/interceptor_common.h | 94 ++++++++++--------- include/grpcpp/impl/proto_utils.h | 6 +- include/grpcpp/impl/rpc_service_method.h | 17 ++-- .../grpcpp/impl/server_callback_handlers.h | 18 ++-- include/grpcpp/impl/service_type.h | 14 +-- include/grpcpp/impl/sync.h | 4 +- include/grpcpp/server_interface.h | 6 +- include/grpcpp/support/async_stream.h | 90 +++++++++--------- include/grpcpp/support/async_unary_call.h | 20 ++-- include/grpcpp/support/callback_common.h | 16 ++-- include/grpcpp/support/client_callback.h | 34 +++---- include/grpcpp/support/client_interceptor.h | 4 +- include/grpcpp/support/method_handler.h | 4 +- include/grpcpp/support/proto_buffer_reader.h | 10 +- include/grpcpp/support/proto_buffer_writer.h | 10 +- include/grpcpp/support/server_interceptor.h | 4 +- include/grpcpp/support/sync_stream.h | 22 ++--- include/grpcpp/version_info.h | 4 +- .../chttp2/transport/hpack_parser.cc | 63 +++++++------ .../transport/chttp2/transport/hpack_parser.h | 2 + .../!ProtoCompiler-gRPCCppPlugin.podspec | 2 +- .../!ProtoCompiler-gRPCPlugin.podspec | 2 +- src/objective-c/GRPCClient/version.h | 2 +- 31 files changed, 255 insertions(+), 234 deletions(-) diff --git a/gRPC-C++.podspec b/gRPC-C++.podspec index 5f96b3f2e7..76d9b885e7 100644 --- a/gRPC-C++.podspec +++ b/gRPC-C++.podspec @@ -22,7 +22,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-C++' # TODO (mxyan): use version that match gRPC version when pod is stabilized - version = '1.64.2' + version = '1.64.3' s.version = version s.summary = 'gRPC C++ library' s.homepage = 'https://grpc.io' @@ -243,6 +243,8 @@ Pod::Spec.new do |s| ss.dependency 'abseil/functional/bind_front', abseil_version ss.dependency 'abseil/functional/function_ref', abseil_version ss.dependency 'abseil/hash/hash', abseil_version + ss.dependency 'abseil/log/absl_check', abseil_version + ss.dependency 'abseil/log/absl_log', abseil_version ss.dependency 'abseil/log/check', abseil_version ss.dependency 'abseil/log/globals', abseil_version ss.dependency 'abseil/log/log', abseil_version diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index de8e93ec3f..9103c15dc2 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -21,7 +21,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-Core' - version = '1.64.2' + version = '1.64.3' s.version = version s.summary = 'Core cross-platform gRPC library, written in C' s.homepage = 'https://grpc.io' diff --git a/gRPC-ProtoRPC.podspec b/gRPC-ProtoRPC.podspec index 8f48e1eea1..629227d790 100644 --- a/gRPC-ProtoRPC.podspec +++ b/gRPC-ProtoRPC.podspec @@ -21,7 +21,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-ProtoRPC' - version = '1.64.2' + version = '1.64.3' s.version = version s.summary = 'RPC library for Protocol Buffers, based on gRPC' s.homepage = 'https://grpc.io' diff --git a/gRPC-RxLibrary.podspec b/gRPC-RxLibrary.podspec index 616a4fe3d0..19bd097875 100644 --- a/gRPC-RxLibrary.podspec +++ b/gRPC-RxLibrary.podspec @@ -21,7 +21,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-RxLibrary' - version = '1.64.2' + version = '1.64.3' s.version = version s.summary = 'Reactive Extensions library for iOS/OSX.' s.homepage = 'https://grpc.io' diff --git a/gRPC.podspec b/gRPC.podspec index 131b5396ec..3ac9fafd18 100644 --- a/gRPC.podspec +++ b/gRPC.podspec @@ -20,7 +20,7 @@ Pod::Spec.new do |s| s.name = 'gRPC' - version = '1.64.2' + version = '1.64.3' s.version = version s.summary = 'gRPC client library for iOS/OSX' s.homepage = 'https://grpc.io' diff --git a/include/grpcpp/client_context.h b/include/grpcpp/client_context.h index 2328e3e6fc..d0934dd0f5 100644 --- a/include/grpcpp/client_context.h +++ b/include/grpcpp/client_context.h @@ -38,7 +38,7 @@ #include #include -#include "absl/log/check.h" +#include "absl/log/absl_check.h" #include #include @@ -248,7 +248,7 @@ class ClientContext { /// \return A multimap of initial metadata key-value pairs from the server. const std::multimap& GetServerInitialMetadata() const { - CHECK(initial_metadata_received_); + ABSL_CHECK(initial_metadata_received_); return *recv_initial_metadata_.map(); } diff --git a/include/grpcpp/completion_queue.h b/include/grpcpp/completion_queue.h index bfd138b594..63d202b0e2 100644 --- a/include/grpcpp/completion_queue.h +++ b/include/grpcpp/completion_queue.h @@ -34,7 +34,7 @@ #include -#include "absl/log/check.h" +#include "absl/log/absl_check.h" #include #include @@ -325,7 +325,7 @@ class CompletionQueue : private grpc::internal::GrpcLibrary { bool ok = ev.success != 0; void* ignored = tag; if (tag->FinalizeResult(&ignored, &ok)) { - CHECK(ignored == tag); + ABSL_CHECK(ignored == tag); return ok; } } @@ -346,7 +346,7 @@ class CompletionQueue : private grpc::internal::GrpcLibrary { bool ok = ev.success != 0; void* ignored = tag; // the tag must be swallowed if using TryPluck - CHECK(!tag->FinalizeResult(&ignored, &ok)); + ABSL_CHECK(!tag->FinalizeResult(&ignored, &ok)); } /// Performs a single polling pluck on \a tag. Calls tag->FinalizeResult if @@ -363,7 +363,7 @@ class CompletionQueue : private grpc::internal::GrpcLibrary { bool ok = ev.success != 0; void* ignored = tag; - CHECK(!tag->FinalizeResult(&ignored, &ok)); + ABSL_CHECK(!tag->FinalizeResult(&ignored, &ok)); } /// Manage state of avalanching operations : completion queue tags that diff --git a/include/grpcpp/impl/call_op_set.h b/include/grpcpp/impl/call_op_set.h index 56ce628908..3eabe6b0ce 100644 --- a/include/grpcpp/impl/call_op_set.h +++ b/include/grpcpp/impl/call_op_set.h @@ -23,7 +23,8 @@ #include #include -#include "absl/log/check.h" +#include "absl/log/absl_check.h" +#include "absl/log/absl_log.h" #include #include @@ -318,7 +319,7 @@ class CallOpSendMessage { return; } if (msg_ != nullptr) { - CHECK(serializer_(msg_).ok()); + ABSL_CHECK(serializer_(msg_).ok()); } serializer_ = nullptr; grpc_op* op = &ops[(*nops)++]; @@ -797,7 +798,7 @@ class CallOpClientRecvStatus { if (recv_status_ == nullptr || hijacked_) return; if (static_cast(status_code_) == StatusCode::OK) { *recv_status_ = Status(); - DCHECK_EQ(debug_error_string_, nullptr); + ABSL_DCHECK_EQ(debug_error_string_, nullptr); } else { *recv_status_ = Status(static_cast(status_code_), @@ -974,9 +975,9 @@ class CallOpSet : public CallOpSetInterface, // A failure here indicates an API misuse; for example, doing a Write // while another Write is already pending on the same RPC or invoking // WritesDone multiple times - gpr_log(GPR_ERROR, "API misuse of type %s observed", - grpc_call_error_to_string(err)); - CHECK(false); + ABSL_LOG(ERROR) << "API misuse of type " << grpc_call_error_to_string(err) + << " observed"; + ABSL_CHECK(false); } } @@ -986,8 +987,8 @@ class CallOpSet : public CallOpSetInterface, done_intercepting_ = true; // The following call_start_batch is internally-generated so no need for an // explanatory log on failure. - CHECK(grpc_call_start_batch(call_.call(), nullptr, 0, core_cq_tag(), - nullptr) == GRPC_CALL_OK); + ABSL_CHECK(grpc_call_start_batch(call_.call(), nullptr, 0, core_cq_tag(), + nullptr) == GRPC_CALL_OK); } private: diff --git a/include/grpcpp/impl/interceptor_common.h b/include/grpcpp/impl/interceptor_common.h index f8b104ba89..7e3a566f6b 100644 --- a/include/grpcpp/impl/interceptor_common.h +++ b/include/grpcpp/impl/interceptor_common.h @@ -22,7 +22,7 @@ #include #include -#include "absl/log/check.h" +#include "absl/log/absl_check.h" #include #include @@ -58,15 +58,16 @@ class InterceptorBatchMethodsImpl if (call_->client_rpc_info() != nullptr) { return ProceedClient(); } - CHECK_NE(call_->server_rpc_info(), nullptr); + ABSL_CHECK_NE(call_->server_rpc_info(), nullptr); ProceedServer(); } void Hijack() override { // Only the client can hijack when sending down initial metadata - CHECK(!reverse_ && ops_ != nullptr && call_->client_rpc_info() != nullptr); + ABSL_CHECK(!reverse_ && ops_ != nullptr && + call_->client_rpc_info() != nullptr); // It is illegal to call Hijack twice - CHECK(!ran_hijacking_interceptor_); + ABSL_CHECK(!ran_hijacking_interceptor_); auto* rpc_info = call_->client_rpc_info(); rpc_info->hijacked_ = true; rpc_info->hijacked_interceptor_ = current_interceptor_index_; @@ -81,21 +82,21 @@ class InterceptorBatchMethodsImpl } ByteBuffer* GetSerializedSendMessage() override { - CHECK_NE(orig_send_message_, nullptr); + ABSL_CHECK_NE(orig_send_message_, nullptr); if (*orig_send_message_ != nullptr) { - CHECK(serializer_(*orig_send_message_).ok()); + ABSL_CHECK(serializer_(*orig_send_message_).ok()); *orig_send_message_ = nullptr; } return send_message_; } const void* GetSendMessage() override { - CHECK_NE(orig_send_message_, nullptr); + ABSL_CHECK_NE(orig_send_message_, nullptr); return *orig_send_message_; } void ModifySendMessage(const void* message) override { - CHECK_NE(orig_send_message_, nullptr); + ABSL_CHECK_NE(orig_send_message_, nullptr); *orig_send_message_ = message; } @@ -130,7 +131,7 @@ class InterceptorBatchMethodsImpl Status* GetRecvStatus() override { return recv_status_; } void FailHijackedSendMessage() override { - CHECK(hooks_[static_cast( + ABSL_CHECK(hooks_[static_cast( experimental::InterceptionHookPoints::PRE_SEND_MESSAGE)]); *fail_send_message_ = true; } @@ -193,7 +194,7 @@ class InterceptorBatchMethodsImpl } void FailHijackedRecvMessage() override { - CHECK(hooks_[static_cast( + ABSL_CHECK(hooks_[static_cast( experimental::InterceptionHookPoints::PRE_RECV_MESSAGE)]); *hijacked_recv_message_failed_ = true; } @@ -237,7 +238,7 @@ class InterceptorBatchMethodsImpl // ContinueFinalizeOpsAfterInterception will be called. Note that neither of // them is invoked if there were no interceptors registered. bool RunInterceptors() { - CHECK(ops_); + ABSL_CHECK(ops_); auto* client_rpc_info = call_->client_rpc_info(); if (client_rpc_info != nullptr) { if (client_rpc_info->interceptors_.empty()) { @@ -262,8 +263,8 @@ class InterceptorBatchMethodsImpl // SyncRequest. bool RunInterceptors(std::function f) { // This is used only by the server for initial call request - CHECK_EQ(reverse_, true); - CHECK_EQ(call_->client_rpc_info(), nullptr); + ABSL_CHECK_EQ(reverse_, true); + ABSL_CHECK_EQ(call_->client_rpc_info(), nullptr); auto* server_rpc_info = call_->server_rpc_info(); if (server_rpc_info == nullptr || server_rpc_info->interceptors_.empty()) { return true; @@ -357,7 +358,7 @@ class InterceptorBatchMethodsImpl return ops_->ContinueFinalizeResultAfterInterception(); } } - CHECK(callback_); + ABSL_CHECK(callback_); callback_(); } @@ -423,98 +424,103 @@ class CancelInterceptorBatchMethods void Hijack() override { // Only the client can hijack when sending down initial metadata - CHECK(false) << "It is illegal to call Hijack on a method which has a " - "Cancel notification"; + ABSL_CHECK(false) << "It is illegal to call Hijack on a method which has a " + "Cancel notification"; } ByteBuffer* GetSerializedSendMessage() override { - CHECK(false) << "It is illegal to call GetSendMessage on a method which " - "has a Cancel notification"; + ABSL_CHECK(false) + << "It is illegal to call GetSendMessage on a method which " + "has a Cancel notification"; return nullptr; } bool GetSendMessageStatus() override { - CHECK(false) + ABSL_CHECK(false) << "It is illegal to call GetSendMessageStatus on a method which " "has a Cancel notification"; return false; } const void* GetSendMessage() override { - CHECK(false) + ABSL_CHECK(false) << "It is illegal to call GetOriginalSendMessage on a method which " "has a Cancel notification"; return nullptr; } void ModifySendMessage(const void* /*message*/) override { - CHECK(false) << "It is illegal to call ModifySendMessage on a method which " - "has a Cancel notification"; + ABSL_CHECK(false) + << "It is illegal to call ModifySendMessage on a method which " + "has a Cancel notification"; } std::multimap* GetSendInitialMetadata() override { - CHECK(false) << "It is illegal to call GetSendInitialMetadata on a " - "method which has a Cancel notification"; + ABSL_CHECK(false) << "It is illegal to call GetSendInitialMetadata on a " + "method which has a Cancel notification"; return nullptr; } Status GetSendStatus() override { - CHECK(false) << "It is illegal to call GetSendStatus on a method which " - "has a Cancel notification"; + ABSL_CHECK(false) + << "It is illegal to call GetSendStatus on a method which " + "has a Cancel notification"; return Status(); } void ModifySendStatus(const Status& /*status*/) override { - CHECK(false) << "It is illegal to call ModifySendStatus on a method " - "which has a Cancel notification"; + ABSL_CHECK(false) << "It is illegal to call ModifySendStatus on a method " + "which has a Cancel notification"; } std::multimap* GetSendTrailingMetadata() override { - CHECK(false) << "It is illegal to call GetSendTrailingMetadata on a " - "method which has a Cancel notification"; + ABSL_CHECK(false) << "It is illegal to call GetSendTrailingMetadata on a " + "method which has a Cancel notification"; return nullptr; } void* GetRecvMessage() override { - CHECK(false) << "It is illegal to call GetRecvMessage on a method which " - "has a Cancel notification"; + ABSL_CHECK(false) + << "It is illegal to call GetRecvMessage on a method which " + "has a Cancel notification"; return nullptr; } std::multimap* GetRecvInitialMetadata() override { - CHECK(false) << "It is illegal to call GetRecvInitialMetadata on a " - "method which has a Cancel notification"; + ABSL_CHECK(false) << "It is illegal to call GetRecvInitialMetadata on a " + "method which has a Cancel notification"; return nullptr; } Status* GetRecvStatus() override { - CHECK(false) << "It is illegal to call GetRecvStatus on a method which " - "has a Cancel notification"; + ABSL_CHECK(false) + << "It is illegal to call GetRecvStatus on a method which " + "has a Cancel notification"; return nullptr; } std::multimap* GetRecvTrailingMetadata() override { - CHECK(false) << "It is illegal to call GetRecvTrailingMetadata on a " - "method which has a Cancel notification"; + ABSL_CHECK(false) << "It is illegal to call GetRecvTrailingMetadata on a " + "method which has a Cancel notification"; return nullptr; } std::unique_ptr GetInterceptedChannel() override { - CHECK(false) << "It is illegal to call GetInterceptedChannel on a " - "method which has a Cancel notification"; + ABSL_CHECK(false) << "It is illegal to call GetInterceptedChannel on a " + "method which has a Cancel notification"; return std::unique_ptr(nullptr); } void FailHijackedRecvMessage() override { - CHECK(false) << "It is illegal to call FailHijackedRecvMessage on a " - "method which has a Cancel notification"; + ABSL_CHECK(false) << "It is illegal to call FailHijackedRecvMessage on a " + "method which has a Cancel notification"; } void FailHijackedSendMessage() override { - CHECK(false) << "It is illegal to call FailHijackedSendMessage on a " - "method which has a Cancel notification"; + ABSL_CHECK(false) << "It is illegal to call FailHijackedSendMessage on a " + "method which has a Cancel notification"; } }; } // namespace internal diff --git a/include/grpcpp/impl/proto_utils.h b/include/grpcpp/impl/proto_utils.h index 0cd4d1bdb4..20d1435842 100644 --- a/include/grpcpp/impl/proto_utils.h +++ b/include/grpcpp/impl/proto_utils.h @@ -21,7 +21,7 @@ #include -#include "absl/log/check.h" +#include "absl/log/absl_check.h" #include #include @@ -53,8 +53,8 @@ Status GenericSerialize(const grpc::protobuf::MessageLite& msg, ByteBuffer* bb, if (static_cast(byte_size) <= GRPC_SLICE_INLINED_SIZE) { Slice slice(byte_size); // We serialize directly into the allocated slices memory - CHECK(slice.end() == msg.SerializeWithCachedSizesToArray( - const_cast(slice.begin()))); + ABSL_CHECK(slice.end() == msg.SerializeWithCachedSizesToArray( + const_cast(slice.begin()))); ByteBuffer tmp(&slice, 1); bb->Swap(&tmp); diff --git a/include/grpcpp/impl/rpc_service_method.h b/include/grpcpp/impl/rpc_service_method.h index 0ce7d7b96f..2881556ee1 100644 --- a/include/grpcpp/impl/rpc_service_method.h +++ b/include/grpcpp/impl/rpc_service_method.h @@ -25,7 +25,8 @@ #include #include -#include "absl/log/check.h" +#include "absl/log/absl_check.h" +#include "absl/log/absl_log.h" #include #include @@ -77,7 +78,7 @@ class MethodHandler { // retained by the handler. Returns nullptr if deserialization failed. virtual void* Deserialize(grpc_call* /*call*/, grpc_byte_buffer* req, Status* /*status*/, void** /*handler_data*/) { - CHECK_EQ(req, nullptr); + ABSL_CHECK_EQ(req, nullptr); return nullptr; } }; @@ -116,12 +117,12 @@ class RpcServiceMethod : public RpcMethod { // this is not an error condition, as it allows users to declare a server // like WithRawMethod_foo. However since it // overwrites behavior, it should be logged. - gpr_log( - GPR_INFO, - "You are marking method %s as '%s', even though it was " - "previously marked '%s'. This behavior will overwrite the original " - "behavior. If you expected this then ignore this message.", - name(), TypeToString(api_type_), TypeToString(type)); + ABSL_LOG(INFO) + << "You are marking method " << name() << " as '" + << TypeToString(api_type_) + << "', even though it was previously marked '" << TypeToString(type) + << "'. This behavior will overwrite the original behavior. If " + "you expected this then ignore this message."; } api_type_ = type; } diff --git a/include/grpcpp/impl/server_callback_handlers.h b/include/grpcpp/impl/server_callback_handlers.h index f9839973fe..c097ab2ace 100644 --- a/include/grpcpp/impl/server_callback_handlers.h +++ b/include/grpcpp/impl/server_callback_handlers.h @@ -18,7 +18,7 @@ #ifndef GRPCPP_IMPL_SERVER_CALLBACK_HANDLERS_H #define GRPCPP_IMPL_SERVER_CALLBACK_HANDLERS_H -#include "absl/log/check.h" +#include "absl/log/absl_check.h" #include #include @@ -149,7 +149,7 @@ class CallbackUnaryHandler : public grpc::internal::MethodHandler { } void SendInitialMetadata() override { - CHECK(!ctx_->sent_initial_metadata_); + ABSL_CHECK(!ctx_->sent_initial_metadata_); this->Ref(); // The callback for this function should not be marked inline because it // is directly invoking a user-controlled reaction @@ -337,7 +337,7 @@ class CallbackClientStreamingHandler : public grpc::internal::MethodHandler { } void SendInitialMetadata() override { - CHECK(!ctx_->sent_initial_metadata_); + ABSL_CHECK(!ctx_->sent_initial_metadata_); this->Ref(); // The callback for this function should not be inlined because it invokes // a user-controlled reaction, but any resulting OnDone can be inlined in @@ -541,7 +541,7 @@ class CallbackServerStreamingHandler : public grpc::internal::MethodHandler { } void SendInitialMetadata() override { - CHECK(!ctx_->sent_initial_metadata_); + ABSL_CHECK(!ctx_->sent_initial_metadata_); this->Ref(); // The callback for this function should not be inlined because it invokes // a user-controlled reaction, but any resulting OnDone can be inlined in @@ -579,7 +579,7 @@ class CallbackServerStreamingHandler : public grpc::internal::MethodHandler { ctx_->sent_initial_metadata_ = true; } // TODO(vjpai): don't assert - CHECK(write_ops_.SendMessagePtr(resp, options).ok()); + ABSL_CHECK(write_ops_.SendMessagePtr(resp, options).ok()); call_.PerformOps(&write_ops_); } @@ -587,7 +587,7 @@ class CallbackServerStreamingHandler : public grpc::internal::MethodHandler { grpc::Status s) override { // This combines the write into the finish callback // TODO(vjpai): don't assert - CHECK(finish_ops_.SendMessagePtr(resp, options).ok()); + ABSL_CHECK(finish_ops_.SendMessagePtr(resp, options).ok()); Finish(std::move(s)); } @@ -753,7 +753,7 @@ class CallbackBidiHandler : public grpc::internal::MethodHandler { } void SendInitialMetadata() override { - CHECK(!ctx_->sent_initial_metadata_); + ABSL_CHECK(!ctx_->sent_initial_metadata_); this->Ref(); // The callback for this function should not be inlined because it invokes // a user-controlled reaction, but any resulting OnDone can be inlined in @@ -791,14 +791,14 @@ class CallbackBidiHandler : public grpc::internal::MethodHandler { ctx_->sent_initial_metadata_ = true; } // TODO(vjpai): don't assert - CHECK(write_ops_.SendMessagePtr(resp, options).ok()); + ABSL_CHECK(write_ops_.SendMessagePtr(resp, options).ok()); call_.PerformOps(&write_ops_); } void WriteAndFinish(const ResponseType* resp, grpc::WriteOptions options, grpc::Status s) override { // TODO(vjpai): don't assert - CHECK(finish_ops_.SendMessagePtr(resp, options).ok()); + ABSL_CHECK(finish_ops_.SendMessagePtr(resp, options).ok()); Finish(std::move(s)); } diff --git a/include/grpcpp/impl/service_type.h b/include/grpcpp/impl/service_type.h index c284026a0f..3e40e08b29 100644 --- a/include/grpcpp/impl/service_type.h +++ b/include/grpcpp/impl/service_type.h @@ -19,7 +19,7 @@ #ifndef GRPCPP_IMPL_SERVICE_TYPE_H #define GRPCPP_IMPL_SERVICE_TYPE_H -#include "absl/log/check.h" +#include "absl/log/absl_check.h" #include #include @@ -152,7 +152,7 @@ class Service { // This does not have to be a hard error, however no one has approached us // with a use case yet. Please file an issue if you believe you have one. size_t idx = static_cast(index); - CHECK_NE(methods_[idx].get(), nullptr) + ABSL_CHECK_NE(methods_[idx].get(), nullptr) << "Cannot mark the method as 'async' because it has already been " "marked as 'generic'."; methods_[idx]->SetServerApiType(internal::RpcServiceMethod::ApiType::ASYNC); @@ -162,7 +162,7 @@ class Service { // This does not have to be a hard error, however no one has approached us // with a use case yet. Please file an issue if you believe you have one. size_t idx = static_cast(index); - CHECK_NE(methods_[idx].get(), nullptr) + ABSL_CHECK_NE(methods_[idx].get(), nullptr) << "Cannot mark the method as 'raw' because it has already " "been marked as 'generic'."; methods_[idx]->SetServerApiType(internal::RpcServiceMethod::ApiType::RAW); @@ -172,7 +172,7 @@ class Service { // This does not have to be a hard error, however no one has approached us // with a use case yet. Please file an issue if you believe you have one. size_t idx = static_cast(index); - CHECK_NE(methods_[idx]->handler(), nullptr) + ABSL_CHECK_NE(methods_[idx]->handler(), nullptr) << "Cannot mark the method as 'generic' because it has already been " "marked as 'async' or 'raw'."; methods_[idx].reset(); @@ -182,7 +182,7 @@ class Service { // This does not have to be a hard error, however no one has approached us // with a use case yet. Please file an issue if you believe you have one. size_t idx = static_cast(index); - CHECK(methods_[idx] && methods_[idx]->handler()) + ABSL_CHECK(methods_[idx] && methods_[idx]->handler()) << "Cannot mark an async or generic method Streamed"; methods_[idx]->SetHandler(streamed_method); @@ -197,7 +197,7 @@ class Service { // This does not have to be a hard error, however no one has approached us // with a use case yet. Please file an issue if you believe you have one. size_t idx = static_cast(index); - CHECK_NE(methods_[idx].get(), nullptr) + ABSL_CHECK_NE(methods_[idx].get(), nullptr) << "Cannot mark the method as 'callback' because it has already been " "marked as 'generic'."; methods_[idx]->SetHandler(handler); @@ -209,7 +209,7 @@ class Service { // This does not have to be a hard error, however no one has approached us // with a use case yet. Please file an issue if you believe you have one. size_t idx = static_cast(index); - CHECK_NE(methods_[idx].get(), nullptr) + ABSL_CHECK_NE(methods_[idx].get(), nullptr) << "Cannot mark the method as 'raw callback' because it has already " "been marked as 'generic'."; methods_[idx]->SetHandler(handler); diff --git a/include/grpcpp/impl/sync.h b/include/grpcpp/impl/sync.h index 9288459196..132e376d7a 100644 --- a/include/grpcpp/impl/sync.h +++ b/include/grpcpp/impl/sync.h @@ -27,7 +27,7 @@ #include -#include "absl/log/check.h" +#include "absl/log/absl_check.h" #include "absl/synchronization/mutex.h" #include @@ -106,7 +106,7 @@ class ABSL_SCOPED_LOCKABLE ReleasableMutexLock { ReleasableMutexLock& operator=(const ReleasableMutexLock&) = delete; void Release() ABSL_UNLOCK_FUNCTION() { - DCHECK(!released_); + ABSL_DCHECK(!released_); released_ = true; mu_->Unlock(); } diff --git a/include/grpcpp/server_interface.h b/include/grpcpp/server_interface.h index 129562016a..266b85313c 100644 --- a/include/grpcpp/server_interface.h +++ b/include/grpcpp/server_interface.h @@ -19,7 +19,7 @@ #ifndef GRPCPP_SERVER_INTERFACE_H #define GRPCPP_SERVER_INTERFACE_H -#include "absl/log/check.h" +#include "absl/log/absl_check.h" #include #include @@ -320,7 +320,7 @@ class ServerInterface : public internal::CallHook { grpc::CompletionQueue* call_cq, grpc::ServerCompletionQueue* notification_cq, void* tag, Message* message) { - CHECK(method); + ABSL_CHECK(method); new PayloadAsyncRequest(method, this, context, stream, call_cq, notification_cq, tag, message); } @@ -331,7 +331,7 @@ class ServerInterface : public internal::CallHook { grpc::CompletionQueue* call_cq, grpc::ServerCompletionQueue* notification_cq, void* tag) { - CHECK(method); + ABSL_CHECK(method); new NoPayloadAsyncRequest(method, this, context, stream, call_cq, notification_cq, tag); } diff --git a/include/grpcpp/support/async_stream.h b/include/grpcpp/support/async_stream.h index ebc7aebcf5..ca849fd348 100644 --- a/include/grpcpp/support/async_stream.h +++ b/include/grpcpp/support/async_stream.h @@ -19,7 +19,7 @@ #ifndef GRPCPP_SUPPORT_ASYNC_STREAM_H #define GRPCPP_SUPPORT_ASYNC_STREAM_H -#include "absl/log/check.h" +#include "absl/log/absl_check.h" #include #include @@ -202,7 +202,7 @@ class ClientAsyncReader final : public ClientAsyncReaderInterface { public: // always allocated against a call arena, no memory free required static void operator delete(void* /*ptr*/, std::size_t size) { - CHECK_EQ(size, sizeof(ClientAsyncReader)); + ABSL_CHECK_EQ(size, sizeof(ClientAsyncReader)); } // This operator should never be called as the memory should be freed as part @@ -210,10 +210,10 @@ class ClientAsyncReader final : public ClientAsyncReaderInterface { // delete to the operator new so that some compilers will not complain (see // https://github.com/grpc/grpc/issues/11301) Note at the time of adding this // there are no tests catching the compiler warning. - static void operator delete(void*, void*) { CHECK(false); } + static void operator delete(void*, void*) { ABSL_CHECK(false); } void StartCall(void* tag) override { - CHECK(!started_); + ABSL_CHECK(!started_); started_ = true; StartCallInternal(tag); } @@ -227,8 +227,8 @@ class ClientAsyncReader final : public ClientAsyncReaderInterface { /// calling code can access the received metadata through the /// \a ClientContext. void ReadInitialMetadata(void* tag) override { - CHECK(started_); - CHECK(!context_->initial_metadata_received_); + ABSL_CHECK(started_); + ABSL_CHECK(!context_->initial_metadata_received_); meta_ops_.set_output_tag(tag); meta_ops_.RecvInitialMetadata(context_); @@ -236,7 +236,7 @@ class ClientAsyncReader final : public ClientAsyncReaderInterface { } void Read(R* msg, void* tag) override { - CHECK(started_); + ABSL_CHECK(started_); read_ops_.set_output_tag(tag); if (!context_->initial_metadata_received_) { read_ops_.RecvInitialMetadata(context_); @@ -251,7 +251,7 @@ class ClientAsyncReader final : public ClientAsyncReaderInterface { /// - the \a ClientContext associated with this call is updated with /// possible initial and trailing metadata received from the server. void Finish(grpc::Status* status, void* tag) override { - CHECK(started_); + ABSL_CHECK(started_); finish_ops_.set_output_tag(tag); if (!context_->initial_metadata_received_) { finish_ops_.RecvInitialMetadata(context_); @@ -267,12 +267,12 @@ class ClientAsyncReader final : public ClientAsyncReaderInterface { const W& request, bool start, void* tag) : context_(context), call_(call), started_(start) { // TODO(ctiller): don't assert - CHECK(init_ops_.SendMessage(request).ok()); + ABSL_CHECK(init_ops_.SendMessage(request).ok()); init_ops_.ClientSendClose(); if (start) { StartCallInternal(tag); } else { - CHECK(tag == nullptr); + ABSL_CHECK(tag == nullptr); } } @@ -350,7 +350,7 @@ class ClientAsyncWriter final : public ClientAsyncWriterInterface { public: // always allocated against a call arena, no memory free required static void operator delete(void* /*ptr*/, std::size_t size) { - CHECK_EQ(size, sizeof(ClientAsyncWriter)); + ABSL_CHECK_EQ(size, sizeof(ClientAsyncWriter)); } // This operator should never be called as the memory should be freed as part @@ -358,10 +358,10 @@ class ClientAsyncWriter final : public ClientAsyncWriterInterface { // delete to the operator new so that some compilers will not complain (see // https://github.com/grpc/grpc/issues/11301) Note at the time of adding this // there are no tests catching the compiler warning. - static void operator delete(void*, void*) { CHECK(false); } + static void operator delete(void*, void*) { ABSL_CHECK(false); } void StartCall(void* tag) override { - CHECK(!started_); + ABSL_CHECK(!started_); started_ = true; StartCallInternal(tag); } @@ -374,8 +374,8 @@ class ClientAsyncWriter final : public ClientAsyncWriterInterface { /// associated with this call is updated, and the calling code can access /// the received metadata through the \a ClientContext. void ReadInitialMetadata(void* tag) override { - CHECK(started_); - CHECK(!context_->initial_metadata_received_); + ABSL_CHECK(started_); + ABSL_CHECK(!context_->initial_metadata_received_); meta_ops_.set_output_tag(tag); meta_ops_.RecvInitialMetadata(context_); @@ -383,27 +383,27 @@ class ClientAsyncWriter final : public ClientAsyncWriterInterface { } void Write(const W& msg, void* tag) override { - CHECK(started_); + ABSL_CHECK(started_); write_ops_.set_output_tag(tag); // TODO(ctiller): don't assert - CHECK(write_ops_.SendMessage(msg).ok()); + ABSL_CHECK(write_ops_.SendMessage(msg).ok()); call_.PerformOps(&write_ops_); } void Write(const W& msg, grpc::WriteOptions options, void* tag) override { - CHECK(started_); + ABSL_CHECK(started_); write_ops_.set_output_tag(tag); if (options.is_last_message()) { options.set_buffer_hint(); write_ops_.ClientSendClose(); } // TODO(ctiller): don't assert - CHECK(write_ops_.SendMessage(msg, options).ok()); + ABSL_CHECK(write_ops_.SendMessage(msg, options).ok()); call_.PerformOps(&write_ops_); } void WritesDone(void* tag) override { - CHECK(started_); + ABSL_CHECK(started_); write_ops_.set_output_tag(tag); write_ops_.ClientSendClose(); call_.PerformOps(&write_ops_); @@ -417,7 +417,7 @@ class ClientAsyncWriter final : public ClientAsyncWriterInterface { /// - attempts to fill in the \a response parameter passed to this class's /// constructor with the server's response message. void Finish(grpc::Status* status, void* tag) override { - CHECK(started_); + ABSL_CHECK(started_); finish_ops_.set_output_tag(tag); if (!context_->initial_metadata_received_) { finish_ops_.RecvInitialMetadata(context_); @@ -437,7 +437,7 @@ class ClientAsyncWriter final : public ClientAsyncWriterInterface { if (start) { StartCallInternal(tag); } else { - CHECK(tag == nullptr); + ABSL_CHECK(tag == nullptr); } } @@ -517,7 +517,7 @@ class ClientAsyncReaderWriter final public: // always allocated against a call arena, no memory free required static void operator delete(void* /*ptr*/, std::size_t size) { - CHECK_EQ(size, sizeof(ClientAsyncReaderWriter)); + ABSL_CHECK_EQ(size, sizeof(ClientAsyncReaderWriter)); } // This operator should never be called as the memory should be freed as part @@ -525,10 +525,10 @@ class ClientAsyncReaderWriter final // delete to the operator new so that some compilers will not complain (see // https://github.com/grpc/grpc/issues/11301) Note at the time of adding this // there are no tests catching the compiler warning. - static void operator delete(void*, void*) { CHECK(false); } + static void operator delete(void*, void*) { ABSL_CHECK(false); } void StartCall(void* tag) override { - CHECK(!started_); + ABSL_CHECK(!started_); started_ = true; StartCallInternal(tag); } @@ -541,8 +541,8 @@ class ClientAsyncReaderWriter final /// is updated with it, and then the receiving initial metadata can /// be accessed through this \a ClientContext. void ReadInitialMetadata(void* tag) override { - CHECK(started_); - CHECK(!context_->initial_metadata_received_); + ABSL_CHECK(started_); + ABSL_CHECK(!context_->initial_metadata_received_); meta_ops_.set_output_tag(tag); meta_ops_.RecvInitialMetadata(context_); @@ -550,7 +550,7 @@ class ClientAsyncReaderWriter final } void Read(R* msg, void* tag) override { - CHECK(started_); + ABSL_CHECK(started_); read_ops_.set_output_tag(tag); if (!context_->initial_metadata_received_) { read_ops_.RecvInitialMetadata(context_); @@ -560,27 +560,27 @@ class ClientAsyncReaderWriter final } void Write(const W& msg, void* tag) override { - CHECK(started_); + ABSL_CHECK(started_); write_ops_.set_output_tag(tag); // TODO(ctiller): don't assert - CHECK(write_ops_.SendMessage(msg).ok()); + ABSL_CHECK(write_ops_.SendMessage(msg).ok()); call_.PerformOps(&write_ops_); } void Write(const W& msg, grpc::WriteOptions options, void* tag) override { - CHECK(started_); + ABSL_CHECK(started_); write_ops_.set_output_tag(tag); if (options.is_last_message()) { options.set_buffer_hint(); write_ops_.ClientSendClose(); } // TODO(ctiller): don't assert - CHECK(write_ops_.SendMessage(msg, options).ok()); + ABSL_CHECK(write_ops_.SendMessage(msg, options).ok()); call_.PerformOps(&write_ops_); } void WritesDone(void* tag) override { - CHECK(started_); + ABSL_CHECK(started_); write_ops_.set_output_tag(tag); write_ops_.ClientSendClose(); call_.PerformOps(&write_ops_); @@ -591,7 +591,7 @@ class ClientAsyncReaderWriter final /// - the \a ClientContext associated with this call is updated with /// possible initial and trailing metadata sent from the server. void Finish(grpc::Status* status, void* tag) override { - CHECK(started_); + ABSL_CHECK(started_); finish_ops_.set_output_tag(tag); if (!context_->initial_metadata_received_) { finish_ops_.RecvInitialMetadata(context_); @@ -608,7 +608,7 @@ class ClientAsyncReaderWriter final if (start) { StartCallInternal(tag); } else { - CHECK(tag == nullptr); + ABSL_CHECK(tag == nullptr); } } @@ -708,7 +708,7 @@ class ServerAsyncReader final : public ServerAsyncReaderInterface { /// - The initial metadata that will be sent to the client from this op will /// be taken from the \a ServerContext associated with the call. void SendInitialMetadata(void* tag) override { - CHECK(!ctx_->sent_initial_metadata_); + ABSL_CHECK(!ctx_->sent_initial_metadata_); meta_ops_.set_output_tag(tag); meta_ops_.SendInitialMetadata(&ctx_->initial_metadata_, @@ -767,7 +767,7 @@ class ServerAsyncReader final : public ServerAsyncReaderInterface { /// gRPC doesn't take ownership or a reference to \a status, so it is safe to /// to deallocate once FinishWithError returns. void FinishWithError(const grpc::Status& status, void* tag) override { - CHECK(!status.ok()); + ABSL_CHECK(!status.ok()); finish_ops_.set_output_tag(tag); if (!ctx_->sent_initial_metadata_) { finish_ops_.SendInitialMetadata(&ctx_->initial_metadata_, @@ -857,7 +857,7 @@ class ServerAsyncWriter final : public ServerAsyncWriterInterface { /// /// \param[in] tag Tag identifying this request. void SendInitialMetadata(void* tag) override { - CHECK(!ctx_->sent_initial_metadata_); + ABSL_CHECK(!ctx_->sent_initial_metadata_); meta_ops_.set_output_tag(tag); meta_ops_.SendInitialMetadata(&ctx_->initial_metadata_, @@ -873,7 +873,7 @@ class ServerAsyncWriter final : public ServerAsyncWriterInterface { write_ops_.set_output_tag(tag); EnsureInitialMetadataSent(&write_ops_); // TODO(ctiller): don't assert - CHECK(write_ops_.SendMessage(msg).ok()); + ABSL_CHECK(write_ops_.SendMessage(msg).ok()); call_.PerformOps(&write_ops_); } @@ -885,7 +885,7 @@ class ServerAsyncWriter final : public ServerAsyncWriterInterface { EnsureInitialMetadataSent(&write_ops_); // TODO(ctiller): don't assert - CHECK(write_ops_.SendMessage(msg, options).ok()); + ABSL_CHECK(write_ops_.SendMessage(msg, options).ok()); call_.PerformOps(&write_ops_); } @@ -904,7 +904,7 @@ class ServerAsyncWriter final : public ServerAsyncWriterInterface { write_ops_.set_output_tag(tag); EnsureInitialMetadataSent(&write_ops_); options.set_buffer_hint(); - CHECK(write_ops_.SendMessage(msg, options).ok()); + ABSL_CHECK(write_ops_.SendMessage(msg, options).ok()); write_ops_.ServerSendStatus(&ctx_->trailing_metadata_, status); call_.PerformOps(&write_ops_); } @@ -1023,7 +1023,7 @@ class ServerAsyncReaderWriter final /// /// \param[in] tag Tag identifying this request. void SendInitialMetadata(void* tag) override { - CHECK(!ctx_->sent_initial_metadata_); + ABSL_CHECK(!ctx_->sent_initial_metadata_); meta_ops_.set_output_tag(tag); meta_ops_.SendInitialMetadata(&ctx_->initial_metadata_, @@ -1045,7 +1045,7 @@ class ServerAsyncReaderWriter final write_ops_.set_output_tag(tag); EnsureInitialMetadataSent(&write_ops_); // TODO(ctiller): don't assert - CHECK(write_ops_.SendMessage(msg).ok()); + ABSL_CHECK(write_ops_.SendMessage(msg).ok()); call_.PerformOps(&write_ops_); } @@ -1055,7 +1055,7 @@ class ServerAsyncReaderWriter final options.set_buffer_hint(); } EnsureInitialMetadataSent(&write_ops_); - CHECK(write_ops_.SendMessage(msg, options).ok()); + ABSL_CHECK(write_ops_.SendMessage(msg, options).ok()); call_.PerformOps(&write_ops_); } @@ -1075,7 +1075,7 @@ class ServerAsyncReaderWriter final write_ops_.set_output_tag(tag); EnsureInitialMetadataSent(&write_ops_); options.set_buffer_hint(); - CHECK(write_ops_.SendMessage(msg, options).ok()); + ABSL_CHECK(write_ops_.SendMessage(msg, options).ok()); write_ops_.ServerSendStatus(&ctx_->trailing_metadata_, status); call_.PerformOps(&write_ops_); } diff --git a/include/grpcpp/support/async_unary_call.h b/include/grpcpp/support/async_unary_call.h index 787d3a56e3..715093fa77 100644 --- a/include/grpcpp/support/async_unary_call.h +++ b/include/grpcpp/support/async_unary_call.h @@ -19,7 +19,7 @@ #ifndef GRPCPP_SUPPORT_ASYNC_UNARY_CALL_H #define GRPCPP_SUPPORT_ASYNC_UNARY_CALL_H -#include "absl/log/check.h" +#include "absl/log/absl_check.h" #include #include @@ -132,7 +132,7 @@ class ClientAsyncResponseReaderHelper { new (grpc_call_arena_alloc(call, sizeof(SingleBufType))) SingleBufType; *single_buf_ptr = single_buf; // TODO(ctiller): don't assert - CHECK(single_buf->SendMessage(request).ok()); + ABSL_CHECK(single_buf->SendMessage(request).ok()); single_buf->ClientSendClose(); // The purpose of the following functions is to type-erase the actual @@ -222,7 +222,7 @@ class ClientAsyncResponseReader final public: // always allocated against a call arena, no memory free required static void operator delete(void* /*ptr*/, std::size_t size) { - CHECK_EQ(size, sizeof(ClientAsyncResponseReader)); + ABSL_CHECK_EQ(size, sizeof(ClientAsyncResponseReader)); } // This operator should never be called as the memory should be freed as part @@ -230,10 +230,10 @@ class ClientAsyncResponseReader final // delete to the operator new so that some compilers will not complain (see // https://github.com/grpc/grpc/issues/11301) Note at the time of adding this // there are no tests catching the compiler warning. - static void operator delete(void*, void*) { CHECK(false); } + static void operator delete(void*, void*) { ABSL_CHECK(false); } void StartCall() override { - DCHECK(!started_); + ABSL_DCHECK(!started_); started_ = true; internal::ClientAsyncResponseReaderHelper::StartCall(context_, single_buf_); } @@ -245,8 +245,8 @@ class ClientAsyncResponseReader final /// - the \a ClientContext associated with this call is updated with /// possible initial and trailing metadata sent from the server. void ReadInitialMetadata(void* tag) override { - DCHECK(started_); - DCHECK(!context_->initial_metadata_received_); + ABSL_DCHECK(started_); + ABSL_DCHECK(!context_->initial_metadata_received_); read_initial_metadata_(context_, &call_, single_buf_, tag); initial_metadata_read_ = true; } @@ -257,7 +257,7 @@ class ClientAsyncResponseReader final /// - the \a ClientContext associated with this call is updated with /// possible initial and trailing metadata sent from the server. void Finish(R* msg, grpc::Status* status, void* tag) override { - DCHECK(started_); + ABSL_DCHECK(started_); finish_(context_, &call_, initial_metadata_read_, single_buf_, &finish_buf_, static_cast(msg), status, tag); } @@ -306,7 +306,7 @@ class ServerAsyncResponseWriter final /// /// \param[in] tag Tag identifying this request. void SendInitialMetadata(void* tag) override { - CHECK(!ctx_->sent_initial_metadata_); + ABSL_CHECK(!ctx_->sent_initial_metadata_); meta_buf_.set_output_tag(tag); meta_buf_.SendInitialMetadata(&ctx_->initial_metadata_, @@ -375,7 +375,7 @@ class ServerAsyncResponseWriter final /// deallocate them once the Finish operation is complete (i.e. a result /// arrives in the completion queue). void FinishWithError(const grpc::Status& status, void* tag) { - CHECK(!status.ok()); + ABSL_CHECK(!status.ok()); finish_buf_.set_output_tag(tag); if (!ctx_->sent_initial_metadata_) { finish_buf_.SendInitialMetadata(&ctx_->initial_metadata_, diff --git a/include/grpcpp/support/callback_common.h b/include/grpcpp/support/callback_common.h index 2868de0bd4..0de9cbcf05 100644 --- a/include/grpcpp/support/callback_common.h +++ b/include/grpcpp/support/callback_common.h @@ -21,7 +21,7 @@ #include -#include "absl/log/check.h" +#include "absl/log/absl_check.h" #include #include @@ -73,7 +73,7 @@ class CallbackWithStatusTag : public grpc_completion_queue_functor { public: // always allocated against a call arena, no memory free required static void operator delete(void* /*ptr*/, std::size_t size) { - CHECK_EQ(size, sizeof(CallbackWithStatusTag)); + ABSL_CHECK_EQ(size, sizeof(CallbackWithStatusTag)); } // This operator should never be called as the memory should be freed as part @@ -81,7 +81,7 @@ class CallbackWithStatusTag : public grpc_completion_queue_functor { // delete to the operator new so that some compilers will not complain (see // https://github.com/grpc/grpc/issues/11301) Note at the time of adding this // there are no tests catching the compiler warning. - static void operator delete(void*, void*) { CHECK(false); } + static void operator delete(void*, void*) { ABSL_CHECK(false); } CallbackWithStatusTag(grpc_call* call, std::function f, CompletionQueueTag* ops) @@ -120,7 +120,7 @@ class CallbackWithStatusTag : public grpc_completion_queue_functor { // The tag was swallowed return; } - CHECK(ignored == ops_); + ABSL_CHECK(ignored == ops_); // Last use of func_ or status_, so ok to move them out auto func = std::move(func_); @@ -139,7 +139,7 @@ class CallbackWithSuccessTag : public grpc_completion_queue_functor { public: // always allocated against a call arena, no memory free required static void operator delete(void* /*ptr*/, std::size_t size) { - CHECK_EQ(size, sizeof(CallbackWithSuccessTag)); + ABSL_CHECK_EQ(size, sizeof(CallbackWithSuccessTag)); } // This operator should never be called as the memory should be freed as part @@ -147,7 +147,7 @@ class CallbackWithSuccessTag : public grpc_completion_queue_functor { // delete to the operator new so that some compilers will not complain (see // https://github.com/grpc/grpc/issues/11301) Note at the time of adding this // there are no tests catching the compiler warning. - static void operator delete(void*, void*) { CHECK(false); } + static void operator delete(void*, void*) { ABSL_CHECK(false); } CallbackWithSuccessTag() : call_(nullptr) {} @@ -164,7 +164,7 @@ class CallbackWithSuccessTag : public grpc_completion_queue_functor { // callbacks. void Set(grpc_call* call, std::function f, CompletionQueueTag* ops, bool can_inline) { - CHECK_EQ(call_, nullptr); + ABSL_CHECK_EQ(call_, nullptr); grpc_call_ref(call); call_ = call; func_ = std::move(f); @@ -210,7 +210,7 @@ class CallbackWithSuccessTag : public grpc_completion_queue_functor { #endif bool do_callback = ops_->FinalizeResult(&ignored, &ok); #ifndef NDEBUG - DCHECK(ignored == ops); + ABSL_DCHECK(ignored == ops); #endif if (do_callback) { diff --git a/include/grpcpp/support/client_callback.h b/include/grpcpp/support/client_callback.h index 49e52bb37a..f306b26b96 100644 --- a/include/grpcpp/support/client_callback.h +++ b/include/grpcpp/support/client_callback.h @@ -22,7 +22,7 @@ #include #include -#include "absl/log/check.h" +#include "absl/log/absl_check.h" #include #include @@ -72,7 +72,7 @@ class CallbackUnaryCallImpl { const InputMessage* request, OutputMessage* result, std::function on_completion) { grpc::CompletionQueue* cq = channel->CallbackCQ(); - CHECK_NE(cq, nullptr); + ABSL_CHECK_NE(cq, nullptr); grpc::internal::Call call(channel->CreateCall(method, context, cq)); using FullCallOpSet = grpc::internal::CallOpSet< @@ -306,7 +306,7 @@ class ClientBidiReactor : public internal::ClientReactor { /// The argument to AddMultipleHolds must be positive. void AddHold() { AddMultipleHolds(1); } void AddMultipleHolds(int holds) { - DCHECK_GT(holds, 0); + ABSL_DCHECK_GT(holds, 0); stream_->AddHold(holds); } void RemoveHold() { stream_->RemoveHold(); } @@ -370,7 +370,7 @@ class ClientReadReactor : public internal::ClientReactor { void AddHold() { AddMultipleHolds(1); } void AddMultipleHolds(int holds) { - DCHECK_GT(holds, 0); + ABSL_DCHECK_GT(holds, 0); reader_->AddHold(holds); } void RemoveHold() { reader_->RemoveHold(); } @@ -402,7 +402,7 @@ class ClientWriteReactor : public internal::ClientReactor { void AddHold() { AddMultipleHolds(1); } void AddMultipleHolds(int holds) { - DCHECK_GT(holds, 0); + ABSL_DCHECK_GT(holds, 0); writer_->AddHold(holds); } void RemoveHold() { writer_->RemoveHold(); } @@ -463,7 +463,7 @@ class ClientCallbackReaderWriterImpl public: // always allocated against a call arena, no memory free required static void operator delete(void* /*ptr*/, std::size_t size) { - CHECK_EQ(size, sizeof(ClientCallbackReaderWriterImpl)); + ABSL_CHECK_EQ(size, sizeof(ClientCallbackReaderWriterImpl)); } // This operator should never be called as the memory should be freed as part @@ -471,7 +471,7 @@ class ClientCallbackReaderWriterImpl // delete to the operator new so that some compilers will not complain (see // https://github.com/grpc/grpc/issues/11301) Note at the time of adding this // there are no tests catching the compiler warning. - static void operator delete(void*, void*) { CHECK(false); } + static void operator delete(void*, void*) { ABSL_CHECK(false); } void StartCall() ABSL_LOCKS_EXCLUDED(start_mu_) override { // This call initiates two batches, plus any backlog, each with a callback @@ -529,7 +529,7 @@ class ClientCallbackReaderWriterImpl write_ops_.ClientSendClose(); } // TODO(vjpai): don't assert - CHECK(write_ops_.SendMessagePtr(msg, options).ok()); + ABSL_CHECK(write_ops_.SendMessagePtr(msg, options).ok()); callbacks_outstanding_.fetch_add(1, std::memory_order_relaxed); if (GPR_UNLIKELY(corked_write_needed_)) { write_ops_.SendInitialMetadata(&context_->send_initial_metadata_, @@ -721,7 +721,7 @@ class ClientCallbackReaderImpl : public ClientCallbackReader { public: // always allocated against a call arena, no memory free required static void operator delete(void* /*ptr*/, std::size_t size) { - CHECK_EQ(size, sizeof(ClientCallbackReaderImpl)); + ABSL_CHECK_EQ(size, sizeof(ClientCallbackReaderImpl)); } // This operator should never be called as the memory should be freed as part @@ -729,7 +729,7 @@ class ClientCallbackReaderImpl : public ClientCallbackReader { // delete to the operator new so that some compilers will not complain (see // https://github.com/grpc/grpc/issues/11301) Note at the time of adding this // there are no tests catching the compiler warning. - static void operator delete(void*, void*) { CHECK(false); } + static void operator delete(void*, void*) { ABSL_CHECK(false); } void StartCall() override { // This call initiates two batches, plus any backlog, each with a callback @@ -806,7 +806,7 @@ class ClientCallbackReaderImpl : public ClientCallbackReader { : context_(context), call_(call), reactor_(reactor) { this->BindReactor(reactor); // TODO(vjpai): don't assert - CHECK(start_ops_.SendMessagePtr(request).ok()); + ABSL_CHECK(start_ops_.SendMessagePtr(request).ok()); start_ops_.ClientSendClose(); } @@ -882,7 +882,7 @@ class ClientCallbackWriterImpl : public ClientCallbackWriter { public: // always allocated against a call arena, no memory free required static void operator delete(void* /*ptr*/, std::size_t size) { - CHECK_EQ(size, sizeof(ClientCallbackWriterImpl)); + ABSL_CHECK_EQ(size, sizeof(ClientCallbackWriterImpl)); } // This operator should never be called as the memory should be freed as part @@ -890,7 +890,7 @@ class ClientCallbackWriterImpl : public ClientCallbackWriter { // delete to the operator new so that some compilers will not complain (see // https://github.com/grpc/grpc/issues/11301) Note at the time of adding this // there are no tests catching the compiler warning. - static void operator delete(void*, void*) { CHECK(false); } + static void operator delete(void*, void*) { ABSL_CHECK(false); } void StartCall() ABSL_LOCKS_EXCLUDED(start_mu_) override { // This call initiates two batches, plus any backlog, each with a callback @@ -931,7 +931,7 @@ class ClientCallbackWriterImpl : public ClientCallbackWriter { write_ops_.ClientSendClose(); } // TODO(vjpai): don't assert - CHECK(write_ops_.SendMessagePtr(msg, options).ok()); + ABSL_CHECK(write_ops_.SendMessagePtr(msg, options).ok()); callbacks_outstanding_.fetch_add(1, std::memory_order_relaxed); if (GPR_UNLIKELY(corked_write_needed_)) { @@ -1112,7 +1112,7 @@ class ClientCallbackUnaryImpl final : public ClientCallbackUnary { public: // always allocated against a call arena, no memory free required static void operator delete(void* /*ptr*/, std::size_t size) { - CHECK_EQ(size, sizeof(ClientCallbackUnaryImpl)); + ABSL_CHECK_EQ(size, sizeof(ClientCallbackUnaryImpl)); } // This operator should never be called as the memory should be freed as part @@ -1120,7 +1120,7 @@ class ClientCallbackUnaryImpl final : public ClientCallbackUnary { // delete to the operator new so that some compilers will not complain (see // https://github.com/grpc/grpc/issues/11301) Note at the time of adding this // there are no tests catching the compiler warning. - static void operator delete(void*, void*) { CHECK(false); } + static void operator delete(void*, void*) { ABSL_CHECK(false); } void StartCall() override { // This call initiates two batches, each with a callback @@ -1159,7 +1159,7 @@ class ClientCallbackUnaryImpl final : public ClientCallbackUnary { : context_(context), call_(call), reactor_(reactor) { this->BindReactor(reactor); // TODO(vjpai): don't assert - CHECK(start_ops_.SendMessagePtr(request).ok()); + ABSL_CHECK(start_ops_.SendMessagePtr(request).ok()); start_ops_.ClientSendClose(); finish_ops_.RecvMessage(response); finish_ops_.AllowNoMessage(); diff --git a/include/grpcpp/support/client_interceptor.h b/include/grpcpp/support/client_interceptor.h index 3bcb2f1625..67aee26ec3 100644 --- a/include/grpcpp/support/client_interceptor.h +++ b/include/grpcpp/support/client_interceptor.h @@ -22,7 +22,7 @@ #include #include -#include "absl/log/check.h" +#include "absl/log/absl_check.h" #include #include @@ -141,7 +141,7 @@ class ClientRpcInfo { // Runs interceptor at pos \a pos. void RunInterceptor( experimental::InterceptorBatchMethods* interceptor_methods, size_t pos) { - CHECK_LT(pos, interceptors_.size()); + ABSL_CHECK_LT(pos, interceptors_.size()); interceptors_[pos]->Intercept(interceptor_methods); } diff --git a/include/grpcpp/support/method_handler.h b/include/grpcpp/support/method_handler.h index 51821c6da3..6a2d2b22d2 100644 --- a/include/grpcpp/support/method_handler.h +++ b/include/grpcpp/support/method_handler.h @@ -19,7 +19,7 @@ #ifndef GRPCPP_SUPPORT_METHOD_HANDLER_H #define GRPCPP_SUPPORT_METHOD_HANDLER_H -#include "absl/log/check.h" +#include "absl/log/absl_check.h" #include #include @@ -59,7 +59,7 @@ ::grpc::Status CatchingFunctionHandler(Callable&& handler) { template void UnaryRunHandlerHelper(const MethodHandler::HandlerParameter& param, ResponseType* rsp, grpc::Status& status) { - CHECK(!param.server_context->sent_initial_metadata_); + ABSL_CHECK(!param.server_context->sent_initial_metadata_); grpc::internal::CallOpSet diff --git a/include/grpcpp/support/proto_buffer_reader.h b/include/grpcpp/support/proto_buffer_reader.h index f5431d462e..e5ede7a09a 100644 --- a/include/grpcpp/support/proto_buffer_reader.h +++ b/include/grpcpp/support/proto_buffer_reader.h @@ -21,7 +21,7 @@ #include -#include "absl/log/check.h" +#include "absl/log/absl_check.h" #include "absl/strings/cord.h" #include @@ -76,7 +76,7 @@ class ProtoBufferReader : public grpc::protobuf::io::ZeroCopyInputStream { if (backup_count_ > 0) { *data = GRPC_SLICE_START_PTR(*slice_) + GRPC_SLICE_LENGTH(*slice_) - backup_count_; - CHECK_LE(backup_count_, INT_MAX); + ABSL_CHECK_LE(backup_count_, INT_MAX); *size = static_cast(backup_count_); backup_count_ = 0; return true; @@ -87,7 +87,7 @@ class ProtoBufferReader : public grpc::protobuf::io::ZeroCopyInputStream { } *data = GRPC_SLICE_START_PTR(*slice_); // On win x64, int is only 32bit - CHECK_LE(GRPC_SLICE_LENGTH(*slice_), static_cast(INT_MAX)); + ABSL_CHECK_LE(GRPC_SLICE_LENGTH(*slice_), static_cast(INT_MAX)); byte_count_ += * size = static_cast(GRPC_SLICE_LENGTH(*slice_)); return true; } @@ -99,7 +99,7 @@ class ProtoBufferReader : public grpc::protobuf::io::ZeroCopyInputStream { /// bytes that have already been returned by the last call of Next. /// So do the backup and have that ready for a later Next. void BackUp(int count) override { - CHECK_LE(count, static_cast(GRPC_SLICE_LENGTH(*slice_))); + ABSL_CHECK_LE(count, static_cast(GRPC_SLICE_LENGTH(*slice_))); backup_count_ = count; } @@ -175,7 +175,7 @@ class ProtoBufferReader : public grpc::protobuf::io::ZeroCopyInputStream { return true; } } - CHECK_EQ(count, 0); + ABSL_CHECK_EQ(count, 0); return true; } #endif // GRPC_PROTOBUF_CORD_SUPPORT_ENABLED diff --git a/include/grpcpp/support/proto_buffer_writer.h b/include/grpcpp/support/proto_buffer_writer.h index 351b2b826d..e695f14ae1 100644 --- a/include/grpcpp/support/proto_buffer_writer.h +++ b/include/grpcpp/support/proto_buffer_writer.h @@ -21,7 +21,7 @@ #include -#include "absl/log/check.h" +#include "absl/log/absl_check.h" #include "absl/strings/cord.h" #include @@ -65,7 +65,7 @@ class ProtoBufferWriter : public grpc::protobuf::io::ZeroCopyOutputStream { total_size_(total_size), byte_count_(0), have_backup_(false) { - CHECK(!byte_buffer->Valid()); + ABSL_CHECK(!byte_buffer->Valid()); /// Create an empty raw byte buffer and look at its underlying slice buffer grpc_byte_buffer* bp = grpc_raw_byte_buffer_create(nullptr, 0); byte_buffer->set_buffer(bp); @@ -82,7 +82,7 @@ class ProtoBufferWriter : public grpc::protobuf::io::ZeroCopyOutputStream { /// safe for the caller to write from data[0, size - 1]. bool Next(void** data, int* size) override { // Protobuf should not ask for more memory than total_size_. - CHECK_LT(byte_count_, total_size_); + ABSL_CHECK_LT(byte_count_, total_size_); // 1. Use the remaining backup slice if we have one // 2. Otherwise allocate a slice, up to the remaining length needed // or our maximum allocation size @@ -107,7 +107,7 @@ class ProtoBufferWriter : public grpc::protobuf::io::ZeroCopyOutputStream { } *data = GRPC_SLICE_START_PTR(slice_); // On win x64, int is only 32bit - CHECK(GRPC_SLICE_LENGTH(slice_) <= static_cast(INT_MAX)); + ABSL_CHECK(GRPC_SLICE_LENGTH(slice_) <= static_cast(INT_MAX)); byte_count_ += * size = static_cast(GRPC_SLICE_LENGTH(slice_)); // Using grpc_slice_buffer_add could modify slice_ and merge it with the // previous slice. Therefore, use grpc_slice_buffer_add_indexed method to @@ -132,7 +132,7 @@ class ProtoBufferWriter : public grpc::protobuf::io::ZeroCopyOutputStream { /// 2. Split it into the needed (if any) and unneeded part /// 3. Add the needed part back to the slice buffer /// 4. Mark that we still have the remaining part (for later use/unref) - CHECK_LE(count, static_cast(GRPC_SLICE_LENGTH(slice_))); + ABSL_CHECK_LE(count, static_cast(GRPC_SLICE_LENGTH(slice_))); grpc_slice_buffer_pop(slice_buffer_); if (static_cast(count) == GRPC_SLICE_LENGTH(slice_)) { backup_slice_ = slice_; diff --git a/include/grpcpp/support/server_interceptor.h b/include/grpcpp/support/server_interceptor.h index c30d0aee49..1147235b6b 100644 --- a/include/grpcpp/support/server_interceptor.h +++ b/include/grpcpp/support/server_interceptor.h @@ -22,7 +22,7 @@ #include #include -#include "absl/log/check.h" +#include "absl/log/absl_check.h" #include #include @@ -102,7 +102,7 @@ class ServerRpcInfo { // Runs interceptor at pos \a pos. void RunInterceptor( experimental::InterceptorBatchMethods* interceptor_methods, size_t pos) { - CHECK_LT(pos, interceptors_.size()); + ABSL_CHECK_LT(pos, interceptors_.size()); interceptors_[pos]->Intercept(interceptor_methods); } diff --git a/include/grpcpp/support/sync_stream.h b/include/grpcpp/support/sync_stream.h index ab6ced7343..9b16b07013 100644 --- a/include/grpcpp/support/sync_stream.h +++ b/include/grpcpp/support/sync_stream.h @@ -19,7 +19,7 @@ #ifndef GRPCPP_SUPPORT_SYNC_STREAM_H #define GRPCPP_SUPPORT_SYNC_STREAM_H -#include "absl/log/check.h" +#include "absl/log/absl_check.h" #include #include @@ -186,7 +186,7 @@ class ClientReader final : public ClientReaderInterface { /// the server will be accessible through the \a ClientContext used to /// construct this object. void WaitForInitialMetadata() override { - CHECK(!context_->initial_metadata_received_); + ABSL_CHECK(!context_->initial_metadata_received_); grpc::internal::CallOpSet ops; ops.RecvInitialMetadata(context_); @@ -232,7 +232,7 @@ class ClientReader final : public ClientReaderInterface { grpc::Status status; ops.ClientRecvStatus(context_, &status); call_.PerformOps(&ops); - CHECK(cq_.Pluck(&ops)); + ABSL_CHECK(cq_.Pluck(&ops)); return status; } @@ -261,7 +261,7 @@ class ClientReader final : public ClientReaderInterface { ops.SendInitialMetadata(&context->send_initial_metadata_, context->initial_metadata_flags()); // TODO(ctiller): don't assert - CHECK(ops.SendMessagePtr(&request).ok()); + ABSL_CHECK(ops.SendMessagePtr(&request).ok()); ops.ClientSendClose(); call_.PerformOps(&ops); cq_.Pluck(&ops); @@ -308,7 +308,7 @@ class ClientWriter : public ClientWriterInterface { /// Once complete, the initial metadata read from the server will be /// accessible through the \a ClientContext used to construct this object. void WaitForInitialMetadata() { - CHECK(!context_->initial_metadata_received_); + ABSL_CHECK(!context_->initial_metadata_received_); grpc::internal::CallOpSet ops; ops.RecvInitialMetadata(context_); @@ -366,7 +366,7 @@ class ClientWriter : public ClientWriterInterface { } finish_ops_.ClientRecvStatus(context_, &status); call_.PerformOps(&finish_ops_); - CHECK(cq_.Pluck(&finish_ops_)); + ABSL_CHECK(cq_.Pluck(&finish_ops_)); return status; } @@ -457,7 +457,7 @@ class ClientReaderWriter final : public ClientReaderWriterInterface { /// Once complete, the initial metadata read from the server will be /// accessible through the \a ClientContext used to construct this object. void WaitForInitialMetadata() override { - CHECK(!context_->initial_metadata_received_); + ABSL_CHECK(!context_->initial_metadata_received_); grpc::internal::CallOpSet ops; ops.RecvInitialMetadata(context_); @@ -538,7 +538,7 @@ class ClientReaderWriter final : public ClientReaderWriterInterface { grpc::Status status; ops.ClientRecvStatus(context_, &status); call_.PerformOps(&ops); - CHECK(cq_.Pluck(&ops)); + ABSL_CHECK(cq_.Pluck(&ops)); return status; } @@ -585,7 +585,7 @@ class ServerReader final : public ServerReaderInterface { /// for semantics. Note that initial metadata will be affected by the /// \a ServerContext associated with this call. void SendInitialMetadata() override { - CHECK(!ctx_->sent_initial_metadata_); + ABSL_CHECK(!ctx_->sent_initial_metadata_); grpc::internal::CallOpSet ops; ops.SendInitialMetadata(&ctx_->initial_metadata_, @@ -642,7 +642,7 @@ class ServerWriter final : public ServerWriterInterface { /// Note that initial metadata will be affected by the /// \a ServerContext associated with this call. void SendInitialMetadata() override { - CHECK(!ctx_->sent_initial_metadata_); + ABSL_CHECK(!ctx_->sent_initial_metadata_); grpc::internal::CallOpSet ops; ops.SendInitialMetadata(&ctx_->initial_metadata_, @@ -715,7 +715,7 @@ class ServerReaderWriterBody final { : call_(call), ctx_(ctx) {} void SendInitialMetadata() { - CHECK(!ctx_->sent_initial_metadata_); + ABSL_CHECK(!ctx_->sent_initial_metadata_); grpc::internal::CallOpSet ops; ops.SendInitialMetadata(&ctx_->initial_metadata_, diff --git a/include/grpcpp/version_info.h b/include/grpcpp/version_info.h index a26c1a25ae..82451b9587 100644 --- a/include/grpcpp/version_info.h +++ b/include/grpcpp/version_info.h @@ -20,8 +20,8 @@ #define GRPC_CPP_VERSION_MAJOR 1 #define GRPC_CPP_VERSION_MINOR 64 -#define GRPC_CPP_VERSION_PATCH 2 +#define GRPC_CPP_VERSION_PATCH 3 #define GRPC_CPP_VERSION_TAG "" -#define GRPC_CPP_VERSION_STRING "1.64.2" +#define GRPC_CPP_VERSION_STRING "1.64.3" #endif // GRPCPP_VERSION_INFO_H diff --git a/src/core/ext/transport/chttp2/transport/hpack_parser.cc b/src/core/ext/transport/chttp2/transport/hpack_parser.cc index 4c4500dc28..1ea72ce130 100644 --- a/src/core/ext/transport/chttp2/transport/hpack_parser.cc +++ b/src/core/ext/transport/chttp2/transport/hpack_parser.cc @@ -92,12 +92,14 @@ constexpr Base64InverseTable kBase64InverseTable; class HPackParser::Input { public: Input(grpc_slice_refcount* current_slice_refcount, const uint8_t* begin, - const uint8_t* end, absl::BitGenRef bitsrc, HpackParseResult& error) + const uint8_t* end, absl::BitGenRef bitsrc, + HpackParseResult& frame_error, HpackParseResult& field_error) : current_slice_refcount_(current_slice_refcount), begin_(begin), end_(end), frontier_(begin), - error_(error), + frame_error_(frame_error), + field_error_(field_error), bitsrc_(bitsrc) {} // If input is backed by a slice, retrieve its refcount. If not, return @@ -216,14 +218,18 @@ class HPackParser::Input { // Check if we saw an EOF bool eof_error() const { - return min_progress_size_ != 0 || error_.connection_error(); + return min_progress_size_ != 0 || frame_error_.connection_error(); + } + + // Reset the field error to be ok + void ClearFieldError() { + if (field_error_.ok()) return; + field_error_ = HpackParseResult(); } // Minimum number of bytes to unstuck the current parse size_t min_progress_size() const { return min_progress_size_; } - bool has_error() const { return !error_.ok(); } - // Set the current error - tweaks the error to include a stream id so that // chttp2 does not close the connection. // Intended for errors that are specific to a stream and recoverable. @@ -247,10 +253,7 @@ class HPackParser::Input { // read prior to being able to get further in this parse. void UnexpectedEOF(size_t min_progress_size) { CHECK_GT(min_progress_size, 0u); - if (min_progress_size_ != 0 || error_.connection_error()) { - DCHECK(eof_error()); - return; - } + if (eof_error()) return; // Set min progress size, taking into account bytes parsed already but not // consumed. min_progress_size_ = min_progress_size + (begin_ - frontier_); @@ -303,13 +306,18 @@ class HPackParser::Input { // Do not use this directly, instead use SetErrorAndContinueParsing or // SetErrorAndStopParsing. void SetError(HpackParseResult error) { - if (!error_.ok() || min_progress_size_ > 0) { - if (error.connection_error() && !error_.connection_error()) { - error_ = std::move(error); // connection errors dominate + SetErrorFor(frame_error_, error); + SetErrorFor(field_error_, std::move(error)); + } + + void SetErrorFor(HpackParseResult& error, HpackParseResult new_error) { + if (!error.ok() || min_progress_size_ > 0) { + if (new_error.connection_error() && !error.connection_error()) { + error = std::move(new_error); // connection errors dominate } return; } - error_ = std::move(error); + error = std::move(new_error); } // Refcount if we are backed by a slice @@ -321,7 +329,8 @@ class HPackParser::Input { // Frontier denotes the first byte past successfully processed input const uint8_t* frontier_; // Current error - HpackParseResult& error_; + HpackParseResult& frame_error_; + HpackParseResult& field_error_; // If the error was EOF, we flag it here by noting how many more bytes would // be needed to make progress size_t min_progress_size_ = 0; @@ -598,6 +607,7 @@ class HPackParser::Parser { bool ParseTop() { DCHECK(state_.parse_state == ParseState::kTop); auto cur = *input_->Next(); + input_->ClearFieldError(); switch (cur >> 4) { // Literal header not indexed - First byte format: 0000xxxx // Literal header never indexed - First byte format: 0001xxxx @@ -703,7 +713,7 @@ class HPackParser::Parser { break; } gpr_log( - GPR_DEBUG, "HTTP:%d:%s:%s: %s%s", log_info_.stream_id, type, + GPR_INFO, "HTTP:%d:%s:%s: %s%s", log_info_.stream_id, type, log_info_.is_client ? "CLI" : "SVR", memento.md.DebugString().c_str(), memento.parse_status == nullptr ? "" @@ -952,11 +962,10 @@ class HPackParser::Parser { state_.string_length) : String::Parse(input_, state_.is_string_huff_compressed, state_.string_length); - HpackParseResult& status = state_.frame_error; absl::string_view key_string; if (auto* s = absl::get_if(&state_.key)) { key_string = s->as_string_view(); - if (status.ok()) { + if (state_.field_error.ok()) { auto r = ValidateKey(key_string); if (r != ValidateMetadataResult::kOk) { input_->SetErrorAndContinueParsing( @@ -966,7 +975,7 @@ class HPackParser::Parser { } else { const auto* memento = absl::get(state_.key); key_string = memento->md.key(); - if (status.ok() && memento->parse_status != nullptr) { + if (state_.field_error.ok() && memento->parse_status != nullptr) { input_->SetErrorAndContinueParsing(*memento->parse_status); } } @@ -993,16 +1002,16 @@ class HPackParser::Parser { key_string.size() + value.wire_size + hpack_constants::kEntryOverhead; auto md = grpc_metadata_batch::Parse( key_string, std::move(value_slice), state_.add_to_table, transport_size, - [key_string, &status, this](absl::string_view message, const Slice&) { - if (!status.ok()) return; + [key_string, this](absl::string_view message, const Slice&) { + if (!state_.field_error.ok()) return; input_->SetErrorAndContinueParsing( HpackParseResult::MetadataParseError(key_string)); gpr_log(GPR_ERROR, "Error parsing '%s' metadata: %s", std::string(key_string).c_str(), std::string(message).c_str()); }); - HPackTable::Memento memento{std::move(md), - status.PersistentStreamErrorOrNullptr()}; + HPackTable::Memento memento{ + std::move(md), state_.field_error.PersistentStreamErrorOrNullptr()}; input_->UpdateFrontier(); state_.parse_state = ParseState::kTop; if (state_.add_to_table) { @@ -1115,13 +1124,13 @@ grpc_error_handle HPackParser::Parse( std::vector buffer = std::move(unparsed_bytes_); return ParseInput( Input(nullptr, buffer.data(), buffer.data() + buffer.size(), bitsrc, - state_.frame_error), + state_.frame_error, state_.field_error), is_last, call_tracer); } - return ParseInput( - Input(slice.refcount, GRPC_SLICE_START_PTR(slice), - GRPC_SLICE_END_PTR(slice), bitsrc, state_.frame_error), - is_last, call_tracer); + return ParseInput(Input(slice.refcount, GRPC_SLICE_START_PTR(slice), + GRPC_SLICE_END_PTR(slice), bitsrc, state_.frame_error, + state_.field_error), + is_last, call_tracer); } grpc_error_handle HPackParser::ParseInput( diff --git a/src/core/ext/transport/chttp2/transport/hpack_parser.h b/src/core/ext/transport/chttp2/transport/hpack_parser.h index 95f752c3ba..57d39406c8 100644 --- a/src/core/ext/transport/chttp2/transport/hpack_parser.h +++ b/src/core/ext/transport/chttp2/transport/hpack_parser.h @@ -235,6 +235,8 @@ class HPackParser { HPackTable hpack_table; // Error so far for this frame (set by class Input) HpackParseResult frame_error; + // Error so far for this field (set by class Input) + HpackParseResult field_error; // Length of frame so far. uint32_t frame_length = 0; // Length of the string being parsed diff --git a/src/objective-c/!ProtoCompiler-gRPCCppPlugin.podspec b/src/objective-c/!ProtoCompiler-gRPCCppPlugin.podspec index 3f2a2a7429..afd06a038e 100644 --- a/src/objective-c/!ProtoCompiler-gRPCCppPlugin.podspec +++ b/src/objective-c/!ProtoCompiler-gRPCCppPlugin.podspec @@ -42,7 +42,7 @@ Pod::Spec.new do |s| # exclamation mark ensures that other "regular" pods will be able to find it as it'll be installed # before them. s.name = '!ProtoCompiler-gRPCCppPlugin' - v = '1.64.2' + v = '1.64.3' s.version = v s.summary = 'The gRPC ProtoC plugin generates C++ files from .proto services.' s.description = <<-DESC diff --git a/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec b/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec index def6199165..3171898bd8 100644 --- a/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec +++ b/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec @@ -42,7 +42,7 @@ Pod::Spec.new do |s| # exclamation mark ensures that other "regular" pods will be able to find it as it'll be installed # before them. s.name = '!ProtoCompiler-gRPCPlugin' - v = '1.64.2' + v = '1.64.3' s.version = v s.summary = 'The gRPC ProtoC plugin generates Objective-C files from .proto services.' s.description = <<-DESC diff --git a/src/objective-c/GRPCClient/version.h b/src/objective-c/GRPCClient/version.h index 7ad793fd0f..3059eae9e8 100644 --- a/src/objective-c/GRPCClient/version.h +++ b/src/objective-c/GRPCClient/version.h @@ -22,4 +22,4 @@ // instead. This file can be regenerated from the template by running // `tools/buildgen/generate_projects.sh`. -#define GRPC_OBJC_VERSION_STRING @"1.64.2" +#define GRPC_OBJC_VERSION_STRING @"1.64.3"