Openscreen discovery integration for adb client.
The openscreen discovery library will allow adb client on all three
platforms to discover mdns services without relying on having Bonjour on
the host machine.
If the host does have bonjour running, we will fallback to using the
MdnsResponder client.
The openscreen discovery code path will be disabled by default for now.
You can enable it by setting ADB_MDNS_OPENSCREEN=1. Check `adb
host-features` string for 'openscreen_mdns' feature.
Test: test_adb.py
Bug: 152884934
Change-Id: Ief153afe7f080cb21134897d8eaf00d90c6983d8
diff --git a/socket_spec.cpp b/socket_spec.cpp
index 5cad70d..359e238 100644
--- a/socket_spec.cpp
+++ b/socket_spec.cpp
@@ -29,8 +29,8 @@
#include <cutils/sockets.h>
#include "adb.h"
+#include "adb_mdns.h"
#include "adb_utils.h"
-#include "adb_wifi.h"
#include "sysdeps.h"
using namespace std::string_literals;
@@ -197,7 +197,7 @@
} else {
#if ADB_HOST
// Check if the address is an mdns service we can connect to.
- if (auto mdns_info = mdns_get_connect_service_info(address.substr(4));
+ if (auto mdns_info = mdns_get_connect_service_info(std::string(address.substr(4)));
mdns_info != std::nullopt) {
fd->reset(network_connect(mdns_info->addr, mdns_info->port, SOCK_STREAM, 0, error));
if (fd->get() != -1) {