[EventEngine] Return error instead of assertion when hostname is empty in cf_engine (#35353)

<!--

If you know who should review your pull request, please assign it to that
person, otherwise the pull request would get assigned randomly.

If your pull request is for a specific language, please add the appropriate
lang label.

-->

Closes #35353

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/35353 from yijiem:fix-ios-dns-test f84d29a9db
PiperOrigin-RevId: 592339589
pull/35316/head
Yijie Ma 1 year ago committed by Copybara-Service
parent 3e785d395d
commit 07b7ea777e
  1. 9
      src/core/lib/event_engine/cf_engine/dns_service_resolver.cc

@ -50,7 +50,14 @@ void DNSServiceResolverImpl::LookupHostname(
});
return;
}
GPR_ASSERT(!host.empty());
if (host.empty()) {
engine_->Run([on_resolve = std::move(on_resolve),
status = absl::InvalidArgumentError(absl::StrCat(
"host must not be empty in name: ", name))]() mutable {
on_resolve(status);
});
return;
}
if (port_string.empty()) {
if (default_port.empty()) {
engine_->Run([on_resolve = std::move(on_resolve),

Loading…
Cancel
Save