Commit f9992b7e authored by Wez's avatar Wez Committed by Chromium LUCI CQ

[fuchsia] Report error status if reading existing interfaces fails.

NetworkChangeNotifier was mis-reporting the failure status as
ZX_ERR_INVALID_ARGS.  Move the failure logging into the
GetExistingInterfaces() call so that the status can be logged properly.

Bug: 1165716
Bug: b/177088778
Change-Id: I2e0db22ee27b93d1c5b3d199c6286d9898c2adf0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2623012
Commit-Queue: Wez <wez@chromium.org>
Reviewed-by: default avatarDavid Dorwin <ddorwin@chromium.org>
Auto-Submit: Wez <wez@chromium.org>
Cr-Commit-Position: refs/heads/master@{#843073}
parent 244a80c9
...@@ -39,10 +39,9 @@ NetworkChangeNotifierFuchsia::NetworkChangeNotifierFuchsia( ...@@ -39,10 +39,9 @@ NetworkChangeNotifierFuchsia::NetworkChangeNotifierFuchsia(
fuchsia::net::interfaces::WatcherSyncPtr watcher = handle.BindSync(); fuchsia::net::interfaces::WatcherSyncPtr watcher = handle.BindSync();
base::Optional<internal::ExistingInterfaceProperties> interfaces = base::Optional<internal::ExistingInterfaceProperties> interfaces =
internal::GetExistingInterfaces(watcher); internal::GetExistingInterfaces(watcher);
if (!interfaces) { if (!interfaces)
ZX_LOG(ERROR, ZX_ERR_INVALID_ARGS) << "Failed to load existing interfaces";
return; return;
}
handle = watcher.Unbind(); handle = watcher.Unbind();
bool notify_ip_address_changed = false; bool notify_ip_address_changed = false;
for (const auto& interface_entry : *interfaces) { for (const auto& interface_entry : *interfaces) {
......
...@@ -175,14 +175,17 @@ base::Optional<ExistingInterfaceProperties> GetExistingInterfaces( ...@@ -175,14 +175,17 @@ base::Optional<ExistingInterfaceProperties> GetExistingInterfaces(
for (;;) { for (;;) {
fuchsia::net::interfaces::Event event; fuchsia::net::interfaces::Event event;
zx_status_t status = watcher->Watch(&event); zx_status_t status = watcher->Watch(&event);
if (status != ZX_OK) if (status != ZX_OK) {
ZX_LOG(ERROR, status) << "GetExistingInterfaces: Watch() failed";
return base::nullopt; return base::nullopt;
}
switch (event.Which()) { switch (event.Which()) {
case fuchsia::net::interfaces::Event::Tag::kExisting: { case fuchsia::net::interfaces::Event::Tag::kExisting: {
base::Optional<InterfaceProperties> interface = base::Optional<InterfaceProperties> interface =
InterfaceProperties::VerifyAndCreate(std::move(event.existing())); InterfaceProperties::VerifyAndCreate(std::move(event.existing()));
if (!interface) { if (!interface) {
LOG(ERROR) << "GetExistingInterfaces: Invalid kExisting event.";
return base::nullopt; return base::nullopt;
} }
uint64_t id = interface->id(); uint64_t id = interface->id();
...@@ -194,6 +197,7 @@ base::Optional<ExistingInterfaceProperties> GetExistingInterfaces( ...@@ -194,6 +197,7 @@ base::Optional<ExistingInterfaceProperties> GetExistingInterfaces(
// fetching events. // fetching events.
return existing_interfaces; return existing_interfaces;
default: default:
LOG(ERROR) << "GetExistingInterfaces: Unexpected event received.";
return base::nullopt; return base::nullopt;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment