From aeab2000a9b108a8a93de22d7a80c9f0a103e5ad Mon Sep 17 00:00:00 2001 From: Tanvi Jagtap <139093547+tanvi-jagtap@users.noreply.github.com> Date: Tue, 30 Apr 2024 10:17:42 -0700 Subject: [PATCH] [grpc][Gpr_To_Absl_Logging] Migrating from gpr to absl logging GPR_ASSERT (#36459) [grpc][Gpr_To_Absl_Logging] Migrating from gpr to absl logging GPR_ASSERT Replacing GPR_ASSERT with absl CHECK. These changes have been made using string replacement and regex. Will not be replacing all instances of CHECK with CHECK_EQ , CHECK_NE etc because there are too many callsites. Only ones which are doable using very simple regex with least chance of failure will be replaced. Given that we have 5000+ instances of GPR_ASSERT to edit, Doing it manually is too much work for both the author and reviewer. Closes #36459 COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36459 from tanvi-jagtap:tjagtap_src_core_ext_xds 3705a1aabcc4fe182b975ae5e3fad6eee2a65416 PiperOrigin-RevId: 629452815 --- BUILD | 1 + src/core/BUILD | 2 ++ src/core/ext/xds/xds_certificate_provider.cc | 5 +++-- src/core/ext/xds/xds_client.cc | 21 ++++++++++--------- src/core/ext/xds/xds_cluster.cc | 3 ++- .../ext/xds/xds_cluster_specifier_plugin.cc | 3 ++- src/core/ext/xds/xds_endpoint.cc | 3 ++- src/core/ext/xds/xds_http_filters.cc | 6 +++--- src/core/ext/xds/xds_listener.cc | 5 +++-- src/core/ext/xds/xds_route_config.cc | 15 ++++++------- src/core/ext/xds/xds_routing.cc | 5 +++-- src/core/ext/xds/xds_server_config_fetcher.cc | 13 ++++++------ src/core/ext/xds/xds_transport_grpc.cc | 19 +++++++++-------- 13 files changed, 57 insertions(+), 44 deletions(-) diff --git a/BUILD b/BUILD index 0467fbb6f6d..ac6fdddbe11 100644 --- a/BUILD +++ b/BUILD @@ -4282,6 +4282,7 @@ grpc_cc_library( external_deps = [ "absl/base:core_headers", "absl/cleanup", + "absl/log:check", "absl/memory", "absl/status", "absl/status:statusor", diff --git a/src/core/BUILD b/src/core/BUILD index 8500fd11b66..119f61ddfe6 100644 --- a/src/core/BUILD +++ b/src/core/BUILD @@ -5034,6 +5034,7 @@ grpc_cc_library( "absl/base:core_headers", "absl/cleanup", "absl/functional:bind_front", + "absl/log:check", "absl/memory", "absl/random", "absl/status", @@ -5217,6 +5218,7 @@ grpc_cc_library( ], external_deps = [ "absl/base:core_headers", + "absl/log:check", "absl/status", "absl/status:statusor", "absl/strings", diff --git a/src/core/ext/xds/xds_certificate_provider.cc b/src/core/ext/xds/xds_certificate_provider.cc index 365294923de..95e4be8ab3f 100644 --- a/src/core/ext/xds/xds_certificate_provider.cc +++ b/src/core/ext/xds/xds_certificate_provider.cc @@ -21,6 +21,7 @@ #include #include "absl/functional/bind_front.h" +#include "absl/log/check.h" #include "absl/types/optional.h" #include @@ -186,7 +187,7 @@ void XdsCertificateProvider::WatchStatusCallback(std::string cert_name, } } else if (!root_being_watched && root_cert_watcher_ != nullptr) { // Cancel root cert watch. - GPR_ASSERT(root_cert_provider_ != nullptr); + CHECK(root_cert_provider_ != nullptr); root_cert_provider_->distributor()->CancelTlsCertificatesWatch( root_cert_watcher_); root_cert_watcher_ = nullptr; @@ -206,7 +207,7 @@ void XdsCertificateProvider::WatchStatusCallback(std::string cert_name, std::move(watcher), absl::nullopt, identity_cert_name_); } } else if (!identity_being_watched && identity_cert_watcher_ != nullptr) { - GPR_ASSERT(identity_cert_provider_ != nullptr); + CHECK(identity_cert_provider_ != nullptr); identity_cert_provider_->distributor()->CancelTlsCertificatesWatch( identity_cert_watcher_); identity_cert_watcher_ = nullptr; diff --git a/src/core/ext/xds/xds_client.cc b/src/core/ext/xds/xds_client.cc index 134f01687d5..3c04939ec10 100644 --- a/src/core/ext/xds/xds_client.cc +++ b/src/core/ext/xds/xds_client.cc @@ -27,6 +27,7 @@ #include #include "absl/cleanup/cleanup.h" +#include "absl/log/check.h" #include "absl/strings/match.h" #include "absl/strings/str_cat.h" #include "absl/strings/str_join.h" @@ -472,7 +473,7 @@ XdsClient::XdsChannel::XdsChannel(WeakRefCountedPtr xds_client, self->OnConnectivityFailure(std::move(status)); }, &status); - GPR_ASSERT(transport_ != nullptr); + CHECK(transport_ != nullptr); if (!status.ok()) SetChannelStatusLocked(std::move(status)); } @@ -717,8 +718,8 @@ void XdsClient::XdsChannel::RetryableCall::OnCallFinishedLocked() { template void XdsClient::XdsChannel::RetryableCall::StartNewCallLocked() { if (shutting_down_) return; - GPR_ASSERT(xds_channel_->transport_ != nullptr); - GPR_ASSERT(call_ == nullptr); + CHECK(xds_channel_->transport_ != nullptr); + CHECK(call_ == nullptr); if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) { gpr_log(GPR_INFO, "[xds_client %p] xds server %s: start new call from retryable " @@ -1005,7 +1006,7 @@ XdsClient::XdsChannel::AdsCall::AdsCall( GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_refcount_trace) ? "AdsCall" : nullptr), retryable_call_(std::move(retryable_call)) { - GPR_ASSERT(xds_client() != nullptr); + CHECK_NE(xds_client(), nullptr); // Init the ADS call. const char* method = "/envoy.service.discovery.v3.AggregatedDiscoveryService/" @@ -1015,7 +1016,7 @@ XdsClient::XdsChannel::AdsCall::AdsCall( // Passing the initial ref here. This ref will go away when // the StreamEventHandler is destroyed. RefCountedPtr(this))); - GPR_ASSERT(streaming_call_ != nullptr); + CHECK(streaming_call_ != nullptr); // Start the call. if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) { gpr_log(GPR_INFO, @@ -1369,7 +1370,7 @@ XdsClient::XdsChannel::LrsCall::LrsCall( // Init the LRS call. Note that the call will progress every time there's // activity in xds_client()->interested_parties_, which is comprised of // the polling entities from client_channel. - GPR_ASSERT(xds_client() != nullptr); + CHECK_NE(xds_client(), nullptr); const char* method = "/envoy.service.load_stats.v3.LoadReportingService/StreamLoadStats"; streaming_call_ = xds_channel()->transport_->CreateStreamingCall( @@ -1377,7 +1378,7 @@ XdsClient::XdsChannel::LrsCall::LrsCall( // Passing the initial ref here. This ref will go away when // the StreamEventHandler is destroyed. RefCountedPtr(this))); - GPR_ASSERT(streaming_call_ != nullptr); + CHECK(streaming_call_ != nullptr); // Start the call. if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) { gpr_log(GPR_INFO, @@ -1598,7 +1599,7 @@ XdsClient::XdsClient( if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) { gpr_log(GPR_INFO, "[xds_client %p] creating xds client", this); } - GPR_ASSERT(bootstrap_ != nullptr); + CHECK(bootstrap_ != nullptr); if (bootstrap_->node() != nullptr) { gpr_log(GPR_INFO, "[xds_client %p] xDS node ID: %s", this, bootstrap_->node()->id().c_str()); @@ -1853,7 +1854,7 @@ void XdsClient::MaybeRegisterResourceTypeLocked( const XdsResourceType* resource_type) { auto it = resource_types_.find(resource_type->type_url()); if (it != resource_types_.end()) { - GPR_ASSERT(it->second == resource_type); + CHECK(it->second == resource_type); return; } resource_types_.emplace(resource_type->type_url(), resource_type); @@ -1904,7 +1905,7 @@ std::string XdsClient::ConstructFullXdsResourceName( auto uri = URI::Create("xdstp", std::string(authority), absl::StrCat("/", resource_type, "/", key.id), key.query_params, /*fragment=*/""); - GPR_ASSERT(uri.ok()); + CHECK(uri.ok()); return uri->ToString(); } // Old-style name. diff --git a/src/core/ext/xds/xds_cluster.cc b/src/core/ext/xds/xds_cluster.cc index 313d513bf74..4991abe8794 100644 --- a/src/core/ext/xds/xds_cluster.cc +++ b/src/core/ext/xds/xds_cluster.cc @@ -22,6 +22,7 @@ #include #include +#include "absl/log/check.h" #include "absl/status/status.h" #include "absl/status/statusor.h" #include "absl/strings/match.h" @@ -476,7 +477,7 @@ absl::StatusOr> CdsResourceParse( ValidationErrors::ScopedField field(&errors, ".cluster_type"); const auto* custom_cluster_type = envoy_config_cluster_v3_Cluster_cluster_type(cluster); - GPR_ASSERT(custom_cluster_type != nullptr); + CHECK_NE(custom_cluster_type, nullptr); ValidationErrors::ScopedField field2(&errors, ".typed_config"); const auto* typed_config = envoy_config_cluster_v3_Cluster_CustomClusterType_typed_config( diff --git a/src/core/ext/xds/xds_cluster_specifier_plugin.cc b/src/core/ext/xds/xds_cluster_specifier_plugin.cc index 2e3e2f511ce..fbf23e2f80e 100644 --- a/src/core/ext/xds/xds_cluster_specifier_plugin.cc +++ b/src/core/ext/xds/xds_cluster_specifier_plugin.cc @@ -21,6 +21,7 @@ #include #include +#include "absl/log/check.h" #include "absl/status/statusor.h" #include "absl/strings/str_cat.h" #include "absl/types/variant.h" @@ -91,7 +92,7 @@ Json XdsRouteLookupClusterSpecifierPlugin::GenerateLoadBalancingPolicyConfig( upb_JsonEncode(plugin_config, msg_type, symtab, 0, reinterpret_cast(buf), json_size + 1, status.ptr()); auto json = JsonParse(reinterpret_cast(buf)); - GPR_ASSERT(json.ok()); + CHECK(json.ok()); return Json::FromArray({Json::FromObject( {{"rls_experimental", Json::FromObject({ diff --git a/src/core/ext/xds/xds_endpoint.cc b/src/core/ext/xds/xds_endpoint.cc index fb0e53bef5c..c33d8ddc99b 100644 --- a/src/core/ext/xds/xds_endpoint.cc +++ b/src/core/ext/xds/xds_endpoint.cc @@ -25,6 +25,7 @@ #include #include +#include "absl/log/check.h" #include "absl/status/status.h" #include "absl/status/statusor.h" #include "absl/strings/str_cat.h" @@ -407,7 +408,7 @@ absl::StatusOr> EdsResourceParse( ValidationErrors::ScopedField field(&errors, absl::StrCat("[", i, "]")); auto parsed_locality = LocalityParse(endpoints[i], &address_set, &errors); if (parsed_locality.has_value()) { - GPR_ASSERT(parsed_locality->locality.lb_weight != 0); + CHECK_NE(parsed_locality->locality.lb_weight, 0u); // Make sure prorities is big enough. Note that they might not // arrive in priority order. if (eds_resource->priorities.size() < parsed_locality->priority + 1) { diff --git a/src/core/ext/xds/xds_http_filters.cc b/src/core/ext/xds/xds_http_filters.cc index 65103380e1b..03e0a5e9f6d 100644 --- a/src/core/ext/xds/xds_http_filters.cc +++ b/src/core/ext/xds/xds_http_filters.cc @@ -20,6 +20,7 @@ #include #include +#include "absl/log/check.h" #include "absl/types/variant.h" #include "envoy/extensions/filters/http/router/v3/router.upb.h" #include "envoy/extensions/filters/http/router/v3/router.upbdefs.h" @@ -91,11 +92,10 @@ XdsHttpFilterRegistry::XdsHttpFilterRegistry(bool register_builtins) { void XdsHttpFilterRegistry::RegisterFilter( std::unique_ptr filter) { - GPR_ASSERT( - registry_map_.emplace(filter->ConfigProtoName(), filter.get()).second); + CHECK(registry_map_.emplace(filter->ConfigProtoName(), filter.get()).second); auto override_proto_name = filter->OverrideConfigProtoName(); if (!override_proto_name.empty()) { - GPR_ASSERT(registry_map_.emplace(override_proto_name, filter.get()).second); + CHECK(registry_map_.emplace(override_proto_name, filter.get()).second); } owning_list_.push_back(std::move(filter)); } diff --git a/src/core/ext/xds/xds_listener.cc b/src/core/ext/xds/xds_listener.cc index b79ec4c9803..fa0a05aa35f 100644 --- a/src/core/ext/xds/xds_listener.cc +++ b/src/core/ext/xds/xds_listener.cc @@ -21,6 +21,7 @@ #include #include +#include "absl/log/check.h" #include "absl/status/status.h" #include "absl/status/statusor.h" #include "absl/strings/str_cat.h" @@ -873,8 +874,8 @@ void AddFilterChainDataForSourceType( const FilterChain& filter_chain, InternalFilterChainMap::DestinationIp* destination_ip, ValidationErrors* errors) { - GPR_ASSERT(static_cast( - filter_chain.filter_chain_match.source_type) < 3); + CHECK(static_cast(filter_chain.filter_chain_match.source_type) < + 3u); AddFilterChainDataForSourceIpRange( filter_chain, &destination_ip->source_types_array[static_cast( diff --git a/src/core/ext/xds/xds_route_config.cc b/src/core/ext/xds/xds_route_config.cc index 81f07ec9da3..259106c53ba 100644 --- a/src/core/ext/xds/xds_route_config.cc +++ b/src/core/ext/xds/xds_route_config.cc @@ -27,6 +27,7 @@ #include #include +#include "absl/log/check.h" #include "absl/status/status.h" #include "absl/status/statusor.h" #include "absl/strings/str_cat.h" @@ -464,7 +465,7 @@ absl::optional RoutePathMatchParse( } else if (envoy_config_route_v3_RouteMatch_has_safe_regex(match)) { const envoy_type_matcher_v3_RegexMatcher* regex_matcher = envoy_config_route_v3_RouteMatch_safe_regex(match); - GPR_ASSERT(regex_matcher != nullptr); + CHECK_NE(regex_matcher, nullptr); type = StringMatcher::Type::kSafeRegex; match_string = UpbStringToStdString( envoy_type_matcher_v3_RegexMatcher_regex(regex_matcher)); @@ -492,7 +493,7 @@ void RouteHeaderMatchersParse(const envoy_config_route_v3_RouteMatch* match, ValidationErrors::ScopedField field(errors, absl::StrCat(".headers[", i, "]")); const envoy_config_route_v3_HeaderMatcher* header = headers[i]; - GPR_ASSERT(header != nullptr); + CHECK_NE(header, nullptr); const std::string name = UpbStringToStdString(envoy_config_route_v3_HeaderMatcher_name(header)); HeaderMatcher::Type type; @@ -521,7 +522,7 @@ void RouteHeaderMatchersParse(const envoy_config_route_v3_RouteMatch* match, header)) { const envoy_type_matcher_v3_RegexMatcher* regex_matcher = envoy_config_route_v3_HeaderMatcher_safe_regex_match(header); - GPR_ASSERT(regex_matcher != nullptr); + CHECK_NE(regex_matcher, nullptr); type = HeaderMatcher::Type::kSafeRegex; match_string = UpbStringToStdString( envoy_type_matcher_v3_RegexMatcher_regex(regex_matcher)); @@ -529,7 +530,7 @@ void RouteHeaderMatchersParse(const envoy_config_route_v3_RouteMatch* match, type = HeaderMatcher::Type::kRange; const envoy_type_v3_Int64Range* range_matcher = envoy_config_route_v3_HeaderMatcher_range_match(header); - GPR_ASSERT(range_matcher != nullptr); + CHECK_NE(range_matcher, nullptr); range_start = envoy_type_v3_Int64Range_start(range_matcher); range_end = envoy_type_v3_Int64Range_end(range_matcher); } else if (envoy_config_route_v3_HeaderMatcher_has_present_match(header)) { @@ -539,7 +540,7 @@ void RouteHeaderMatchersParse(const envoy_config_route_v3_RouteMatch* match, ValidationErrors::ScopedField field(errors, ".string_match"); const auto* matcher = envoy_config_route_v3_HeaderMatcher_string_match(header); - GPR_ASSERT(matcher != nullptr); + CHECK_NE(matcher, nullptr); if (envoy_type_matcher_v3_StringMatcher_has_exact(matcher)) { type = HeaderMatcher::Type::kExact; match_string = UpbStringToStdString( @@ -560,7 +561,7 @@ void RouteHeaderMatchersParse(const envoy_config_route_v3_RouteMatch* match, type = HeaderMatcher::Type::kSafeRegex; const auto* regex_matcher = envoy_type_matcher_v3_StringMatcher_safe_regex(matcher); - GPR_ASSERT(regex_matcher != nullptr); + CHECK_NE(regex_matcher, nullptr); match_string = UpbStringToStdString( envoy_type_matcher_v3_RegexMatcher_regex(regex_matcher)); } else { @@ -886,7 +887,7 @@ absl::optional RouteActionParse( ValidationErrors::ScopedField field(errors, ".weighted_clusters"); const envoy_config_route_v3_WeightedCluster* weighted_clusters_proto = envoy_config_route_v3_RouteAction_weighted_clusters(route_action_proto); - GPR_ASSERT(weighted_clusters_proto != nullptr); + CHECK_NE(weighted_clusters_proto, nullptr); std::vector action_weighted_clusters; uint64_t total_weight = 0; diff --git a/src/core/ext/xds/xds_routing.cc b/src/core/ext/xds/xds_routing.cc index 3c620e7ca7b..4345b4b4e2e 100644 --- a/src/core/ext/xds/xds_routing.cc +++ b/src/core/ext/xds/xds_routing.cc @@ -25,6 +25,7 @@ #include #include +#include "absl/log/check.h" #include "absl/status/status.h" #include "absl/status/statusor.h" #include "absl/strings/match.h" @@ -117,7 +118,7 @@ absl::optional XdsRouting::FindVirtualHostForDomain( // than current match. const MatchType match_type = DomainPatternMatchType(domain_pattern); // This should be caught by RouteConfigParse(). - GPR_ASSERT(match_type != INVALID_MATCH); + CHECK(match_type != INVALID_MATCH); if (match_type > best_match_type) continue; if (match_type == best_match_type && domain_pattern.size() <= longest_match) { @@ -235,7 +236,7 @@ XdsRouting::GeneratePerHTTPFilterConfigs( const XdsHttpFilterImpl* filter_impl = http_filter_registry.GetFilterForType( http_filter.config.config_proto_type_name); - GPR_ASSERT(filter_impl != nullptr); + CHECK_NE(filter_impl, nullptr); // If there is not actually any C-core filter associated with this // xDS filter, then it won't need any config, so skip it. if (filter_impl->channel_filter() == nullptr) continue; diff --git a/src/core/ext/xds/xds_server_config_fetcher.cc b/src/core/ext/xds/xds_server_config_fetcher.cc index a236fd05d75..76b612f987b 100644 --- a/src/core/ext/xds/xds_server_config_fetcher.cc +++ b/src/core/ext/xds/xds_server_config_fetcher.cc @@ -27,6 +27,7 @@ #include #include "absl/base/thread_annotations.h" +#include "absl/log/check.h" #include "absl/status/status.h" #include "absl/status/statusor.h" #include "absl/strings/match.h" @@ -405,7 +406,7 @@ class XdsServerConfigFetcher::ListenerWatcher::FilterChainMatchManager:: absl::StatusOr> Watch( std::unique_ptr watcher) override { - GPR_ASSERT(watcher_ == nullptr); + CHECK(watcher_ == nullptr); watcher_ = std::move(watcher); if (!static_resource_.ok()) { return static_resource_.status(); @@ -518,7 +519,7 @@ XdsServerConfigFetcher::XdsServerConfigFetcher( RefCountedPtr xds_client, grpc_server_xds_status_notifier notifier) : xds_client_(std::move(xds_client)), serving_status_notifier_(notifier) { - GPR_ASSERT(xds_client_ != nullptr); + CHECK(xds_client_ != nullptr); } std::string ListenerResourceName(absl::string_view resource_name_template, @@ -1102,7 +1103,7 @@ absl::StatusOr XdsServerConfigFetcher::ListenerWatcher:: const XdsHttpFilterImpl* filter_impl = http_filter_registry.GetFilterForType( http_filter.config.config_proto_type_name); - GPR_ASSERT(filter_impl != nullptr); + CHECK_NE(filter_impl, nullptr); // Some filters like the router filter are no-op filters and do not have // an implementation. if (filter_impl->channel_filter() != nullptr) { @@ -1151,7 +1152,7 @@ absl::StatusOr XdsServerConfigFetcher::ListenerWatcher:: return result.status(); } xds_certificate_provider = std::move(*result); - GPR_ASSERT(xds_certificate_provider != nullptr); + CHECK(xds_certificate_provider != nullptr); args = args.SetObject(xds_certificate_provider); } return args; @@ -1269,7 +1270,7 @@ XdsServerConfigFetcher::ListenerWatcher::FilterChainMatchManager:: resource_name_(std::move(resource_name)), http_filters_(std::move(http_filters)), resource_(std::move(initial_resource)) { - GPR_ASSERT(!resource_name_.empty()); + CHECK(!resource_name_.empty()); // RouteConfigWatcher is being created here instead of in Watch() to avoid // deadlocks from invoking XdsRouteConfigResourceType::StartWatch whilst in a // critical region. @@ -1296,7 +1297,7 @@ XdsServerConfigFetcher::ListenerWatcher::FilterChainMatchManager:: absl::StatusOr> resource; { MutexLock lock(&mu_); - GPR_ASSERT(watcher_ == nullptr); + CHECK(watcher_ == nullptr); watcher_ = std::move(watcher); resource = resource_; } diff --git a/src/core/ext/xds/xds_transport_grpc.cc b/src/core/ext/xds/xds_transport_grpc.cc index 55cd32776ca..15f80762f65 100644 --- a/src/core/ext/xds/xds_transport_grpc.cc +++ b/src/core/ext/xds/xds_transport_grpc.cc @@ -23,6 +23,7 @@ #include #include +#include "absl/log/check.h" #include "absl/strings/str_cat.h" #include @@ -78,7 +79,7 @@ GrpcXdsTransportFactory::GrpcXdsTransport::GrpcStreamingCall::GrpcStreamingCall( factory_->interested_parties(), Slice::FromStaticString(method), /*authority=*/absl::nullopt, Timestamp::InfFuture(), /*registered_method=*/true); - GPR_ASSERT(call_ != nullptr); + CHECK_NE(call_, nullptr); // Init data associated with the call. grpc_metadata_array_init(&initial_metadata_recv_); grpc_metadata_array_init(&trailing_metadata_recv_); @@ -108,7 +109,7 @@ GrpcXdsTransportFactory::GrpcXdsTransport::GrpcStreamingCall::GrpcStreamingCall( this->Ref(DEBUG_LOCATION, "OnRecvInitialMetadata").release(), nullptr); call_error = grpc_call_start_batch_and_execute( call_, ops, static_cast(op - ops), &on_recv_initial_metadata_); - GPR_ASSERT(GRPC_CALL_OK == call_error); + CHECK_EQ(call_error, GRPC_CALL_OK); // Start a batch for recv_trailing_metadata. memset(ops, 0, sizeof(ops)); op = ops; @@ -125,7 +126,7 @@ GrpcXdsTransportFactory::GrpcXdsTransport::GrpcStreamingCall::GrpcStreamingCall( GRPC_CLOSURE_INIT(&on_status_received_, OnStatusReceived, this, nullptr); call_error = grpc_call_start_batch_and_execute( call_, ops, static_cast(op - ops), &on_status_received_); - GPR_ASSERT(GRPC_CALL_OK == call_error); + CHECK_EQ(call_error, GRPC_CALL_OK); GRPC_CLOSURE_INIT(&on_response_received_, OnResponseReceived, this, nullptr); } @@ -135,12 +136,12 @@ GrpcXdsTransportFactory::GrpcXdsTransport::GrpcStreamingCall:: grpc_byte_buffer_destroy(send_message_payload_); grpc_byte_buffer_destroy(recv_message_payload_); CSliceUnref(status_details_); - GPR_ASSERT(call_ != nullptr); + CHECK_NE(call_, nullptr); grpc_call_unref(call_); } void GrpcXdsTransportFactory::GrpcXdsTransport::GrpcStreamingCall::Orphan() { - GPR_ASSERT(call_ != nullptr); + CHECK_NE(call_, nullptr); // If we are here because xds_client wants to cancel the call, // OnStatusReceived() will complete the cancellation and clean up. // Otherwise, we are here because xds_client has to orphan a failed call, @@ -164,7 +165,7 @@ void GrpcXdsTransportFactory::GrpcXdsTransport::GrpcStreamingCall::SendMessage( Ref(DEBUG_LOCATION, "OnRequestSent").release(); grpc_call_error call_error = grpc_call_start_batch_and_execute(call_, &op, 1, &on_request_sent_); - GPR_ASSERT(GRPC_CALL_OK == call_error); + CHECK_EQ(call_error, GRPC_CALL_OK); } void GrpcXdsTransportFactory::GrpcXdsTransport::GrpcStreamingCall:: @@ -174,10 +175,10 @@ void GrpcXdsTransportFactory::GrpcXdsTransport::GrpcStreamingCall:: memset(&op, 0, sizeof(op)); op.op = GRPC_OP_RECV_MESSAGE; op.data.recv_message.recv_message = &recv_message_payload_; - GPR_ASSERT(call_ != nullptr); + CHECK_NE(call_, nullptr); const grpc_call_error call_error = grpc_call_start_batch_and_execute(call_, &op, 1, &on_response_received_); - GPR_ASSERT(GRPC_CALL_OK == call_error); + CHECK_EQ(call_error, GRPC_CALL_OK); } void GrpcXdsTransportFactory::GrpcXdsTransport::GrpcStreamingCall:: @@ -271,7 +272,7 @@ GrpcXdsTransportFactory::GrpcXdsTransport::GrpcXdsTransport( channel_ = CreateXdsChannel( factory->args_, static_cast(server)); - GPR_ASSERT(channel_ != nullptr); + CHECK(channel_ != nullptr); if (channel_->IsLame()) { *status = absl::UnavailableError("xds client has a lame channel"); } else {