aboutsummaryrefslogtreecommitdiff
path: root/cast
diff options
context:
space:
mode:
authorJordan Bayles <jophba@chromium.org>2020-10-14 13:10:58 -0700
committerCommit Bot <commit-bot@chromium.org>2020-10-15 18:34:43 +0000
commitbd45d582f51ec82302e8f39f4c6fe588a670dfc1 (patch)
tree70e6047b4e24de38d80e13cc6b2e155498090d15 /cast
parenta3f46f23c52688cc3c0de927b7fb8a86ff9e8dff (diff)
downloadopenscreen-bd45d582f51ec82302e8f39f4c6fe588a670dfc1.tar.gz
Allow loopback for discovery
Although not always super useful, we do occasionally want to allow loopback adapters for discovery. This patch removes a CHECK for the hardware address (which is {} for the loopback interface) in favor of warning. Change-Id: Ica4253e176ee58a67bb7a8d19738782007b08ecb Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/2472530 Reviewed-by: Ryan Keane <rwkeane@google.com> Commit-Queue: Jordan Bayles <jophba@chromium.org>
Diffstat (limited to 'cast')
-rw-r--r--cast/standalone_receiver/main.cc10
1 files changed, 7 insertions, 3 deletions
diff --git a/cast/standalone_receiver/main.cc b/cast/standalone_receiver/main.cc
index d9573cd1..0c9d3c1b 100644
--- a/cast/standalone_receiver/main.cc
+++ b/cast/standalone_receiver/main.cc
@@ -79,9 +79,13 @@ ErrorOr<std::unique_ptr<DiscoveryState>> StartDiscovery(
ServiceInfo info;
info.port = kDefaultCastPort;
- OSP_CHECK(std::any_of(interface.hardware_address.begin(),
- interface.hardware_address.end(),
- [](int e) { return e > 0; }));
+ if (std::all_of(interface.hardware_address.begin(),
+ interface.hardware_address.end(),
+ [](int e) { return e == 0; })) {
+ OSP_LOG_WARN
+ << "Hardware address is empty. Either you are on a loopback device "
+ "or getting the network interface information failed somehow.";
+ }
info.unique_id = HexEncode(interface.hardware_address);
info.friendly_name = friendly_name;
info.model_name = model_name;