Merge changes Id8d9fa6c,I47d3ad50,I7cebbf75,Id10e320a am: a227c19ef2 am: 5954016965 am: da4b7221ff
Change-Id: I5241f9f636ca9fe6ce1cb846d0e5d46d427c3c0a
This commit is contained in:
commit
f2420d95a2
13 changed files with 54 additions and 46 deletions
|
|
@ -109,7 +109,9 @@ void handle_online(atransport *t)
|
||||||
{
|
{
|
||||||
D("adb: online");
|
D("adb: online");
|
||||||
t->online = 1;
|
t->online = 1;
|
||||||
|
#if ADB_HOST
|
||||||
t->SetConnectionEstablished(true);
|
t->SetConnectionEstablished(true);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void handle_offline(atransport *t)
|
void handle_offline(atransport *t)
|
||||||
|
|
|
||||||
|
|
@ -73,6 +73,7 @@ static auto& listener_list_mutex = *new std::mutex();
|
||||||
typedef std::list<std::unique_ptr<alistener>> ListenerList;
|
typedef std::list<std::unique_ptr<alistener>> ListenerList;
|
||||||
static ListenerList& listener_list GUARDED_BY(listener_list_mutex) = *new ListenerList();
|
static ListenerList& listener_list GUARDED_BY(listener_list_mutex) = *new ListenerList();
|
||||||
|
|
||||||
|
#if ADB_HOST
|
||||||
static void ss_listener_event_func(int _fd, unsigned ev, void *_l) {
|
static void ss_listener_event_func(int _fd, unsigned ev, void *_l) {
|
||||||
if (ev & FDE_READ) {
|
if (ev & FDE_READ) {
|
||||||
unique_fd fd(adb_socket_accept(_fd, nullptr, nullptr));
|
unique_fd fd(adb_socket_accept(_fd, nullptr, nullptr));
|
||||||
|
|
@ -88,6 +89,7 @@ static void ss_listener_event_func(int _fd, unsigned ev, void *_l) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void listener_event_func(int _fd, unsigned ev, void* _l)
|
static void listener_event_func(int _fd, unsigned ev, void* _l)
|
||||||
{
|
{
|
||||||
|
|
@ -164,7 +166,7 @@ void remove_all_listeners() EXCLUDES(listener_list_mutex) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void enable_daemon_sockets() EXCLUDES(listener_list_mutex) {
|
void enable_server_sockets() EXCLUDES(listener_list_mutex) {
|
||||||
std::lock_guard<std::mutex> lock(listener_list_mutex);
|
std::lock_guard<std::mutex> lock(listener_list_mutex);
|
||||||
for (auto& l : listener_list) {
|
for (auto& l : listener_list) {
|
||||||
if (l->connect_to == "*smartsocket*") {
|
if (l->connect_to == "*smartsocket*") {
|
||||||
|
|
@ -173,6 +175,7 @@ void enable_daemon_sockets() EXCLUDES(listener_list_mutex) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if ADB_HOST
|
||||||
void close_smartsockets() EXCLUDES(listener_list_mutex) {
|
void close_smartsockets() EXCLUDES(listener_list_mutex) {
|
||||||
std::lock_guard<std::mutex> lock(listener_list_mutex);
|
std::lock_guard<std::mutex> lock(listener_list_mutex);
|
||||||
auto pred = [](const std::unique_ptr<alistener>& listener) {
|
auto pred = [](const std::unique_ptr<alistener>& listener) {
|
||||||
|
|
@ -180,6 +183,7 @@ void close_smartsockets() EXCLUDES(listener_list_mutex) {
|
||||||
};
|
};
|
||||||
listener_list.remove_if(pred);
|
listener_list.remove_if(pred);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
InstallStatus install_listener(const std::string& local_name, const char* connect_to,
|
InstallStatus install_listener(const std::string& local_name, const char* connect_to,
|
||||||
atransport* transport, int flags, int* resolved_tcp_port,
|
atransport* transport, int flags, int* resolved_tcp_port,
|
||||||
|
|
@ -188,7 +192,7 @@ InstallStatus install_listener(const std::string& local_name, const char* connec
|
||||||
for (auto& l : listener_list) {
|
for (auto& l : listener_list) {
|
||||||
if (local_name == l->local_name) {
|
if (local_name == l->local_name) {
|
||||||
// Can't repurpose a smartsocket.
|
// Can't repurpose a smartsocket.
|
||||||
if(l->connect_to[0] == '*') {
|
if (l->connect_to[0] == '*') {
|
||||||
*error = "cannot repurpose smartsocket";
|
*error = "cannot repurpose smartsocket";
|
||||||
return INSTALL_STATUS_INTERNAL_ERROR;
|
return INSTALL_STATUS_INTERNAL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
@ -227,7 +231,11 @@ InstallStatus install_listener(const std::string& local_name, const char* connec
|
||||||
|
|
||||||
close_on_exec(listener->fd);
|
close_on_exec(listener->fd);
|
||||||
if (listener->connect_to == "*smartsocket*") {
|
if (listener->connect_to == "*smartsocket*") {
|
||||||
|
#if ADB_HOST
|
||||||
listener->fde = fdevent_create(listener->fd, ss_listener_event_func, listener.get());
|
listener->fde = fdevent_create(listener->fd, ss_listener_event_func, listener.get());
|
||||||
|
#else
|
||||||
|
LOG(FATAL) << "attempted to connect to *smartsocket* in daemon";
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
listener->fde = fdevent_create(listener->fd, listener_event_func, listener.get());
|
listener->fde = fdevent_create(listener->fd, listener_event_func, listener.get());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,8 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __ADB_LISTENERS_H
|
#pragma once
|
||||||
#define __ADB_LISTENERS_H
|
|
||||||
|
|
||||||
#include "adb.h"
|
#include "adb.h"
|
||||||
|
|
||||||
|
|
@ -44,7 +43,7 @@ std::string format_listeners();
|
||||||
InstallStatus remove_listener(const char* local_name, atransport* transport);
|
InstallStatus remove_listener(const char* local_name, atransport* transport);
|
||||||
void remove_all_listeners(void);
|
void remove_all_listeners(void);
|
||||||
|
|
||||||
void enable_daemon_sockets();
|
#if ADB_HOST
|
||||||
|
void enable_server_sockets();
|
||||||
void close_smartsockets();
|
void close_smartsockets();
|
||||||
|
#endif
|
||||||
#endif /* __ADB_LISTENERS_H */
|
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,7 @@ void start_device_log(void) {
|
||||||
int adb_trace_mask;
|
int adb_trace_mask;
|
||||||
|
|
||||||
std::string get_trace_setting() {
|
std::string get_trace_setting() {
|
||||||
#if ADB_HOST
|
#if ADB_HOST || !defined(__ANDROID__)
|
||||||
const char* setting = getenv("ADB_TRACE");
|
const char* setting = getenv("ADB_TRACE");
|
||||||
if (setting == nullptr) {
|
if (setting == nullptr) {
|
||||||
setting = "";
|
setting = "";
|
||||||
|
|
|
||||||
|
|
@ -206,7 +206,7 @@ int adb_server_main(int is_daemon, const std::string& socket_spec, int ack_reply
|
||||||
// We don't accept() client connections until this point: this way, clients
|
// We don't accept() client connections until this point: this way, clients
|
||||||
// can't see wonky state early in startup even if they're connecting directly
|
// can't see wonky state early in startup even if they're connecting directly
|
||||||
// to the server instead of going through the adb program.
|
// to the server instead of going through the adb program.
|
||||||
fdevent_run_on_main_thread([] { enable_daemon_sockets(); });
|
fdevent_run_on_main_thread([] { enable_server_sockets(); });
|
||||||
});
|
});
|
||||||
notify_thread.detach();
|
notify_thread.detach();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -89,8 +89,9 @@ adb -t $TRANSPORT_ID wait-for-disconnect
|
||||||
adb connect $REMOTE
|
adb connect $REMOTE
|
||||||
adb -s $REMOTE wait-for-device
|
adb -s $REMOTE wait-for-device
|
||||||
|
|
||||||
# Run test_device.py again.
|
# Instead of running test_device.py again, which takes forever, do some I/O back and forth instead.
|
||||||
ANDROID_SERIAL=$REMOTE "$OUTPUT_DIR"/../test_device.py
|
dd if=/dev/zero bs=1024 count=10240 | adb -s $REMOTE raw sink:10485760
|
||||||
|
adb -s $REMOTE raw source:10485760 | dd of=/dev/null bs=1024 count=10240
|
||||||
|
|
||||||
# Dump traces again.
|
# Dump traces again.
|
||||||
adb disconnect $REMOTE
|
adb disconnect $REMOTE
|
||||||
|
|
|
||||||
|
|
@ -173,12 +173,6 @@ static void drop_privileges(int server_port) {
|
||||||
LOG(FATAL) << "Could not set SELinux context";
|
LOG(FATAL) << "Could not set SELinux context";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
std::string error;
|
|
||||||
std::string local_name =
|
|
||||||
android::base::StringPrintf("tcp:%d", server_port);
|
|
||||||
if (install_listener(local_name, "*smartsocket*", nullptr, 0, nullptr, &error)) {
|
|
||||||
LOG(FATAL) << "Could not install *smartsocket* listener: " << error;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
struct ProcessInfo {
|
struct ProcessInfo {
|
||||||
const static size_t kMaxArchNameLength = 16;
|
static constexpr size_t kMaxArchNameLength = 16;
|
||||||
|
|
||||||
uint64_t pid;
|
uint64_t pid;
|
||||||
bool debuggable;
|
bool debuggable;
|
||||||
|
|
|
||||||
|
|
@ -108,7 +108,10 @@ asocket* create_local_service_socket(std::string_view destination, atransport* t
|
||||||
|
|
||||||
asocket *create_remote_socket(unsigned id, atransport *t);
|
asocket *create_remote_socket(unsigned id, atransport *t);
|
||||||
void connect_to_remote(asocket* s, std::string_view destination);
|
void connect_to_remote(asocket* s, std::string_view destination);
|
||||||
|
|
||||||
|
#if ADB_HOST
|
||||||
void connect_to_smartsocket(asocket *s);
|
void connect_to_smartsocket(asocket *s);
|
||||||
|
#endif
|
||||||
|
|
||||||
// Internal functions that are only made available here for testing purposes.
|
// Internal functions that are only made available here for testing purposes.
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
|
|
||||||
|
|
@ -520,6 +520,7 @@ void connect_to_remote(asocket* s, std::string_view destination) {
|
||||||
send_packet(p, s->transport);
|
send_packet(p, s->transport);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if ADB_HOST
|
||||||
/* this is used by magic sockets to rig local sockets to
|
/* this is used by magic sockets to rig local sockets to
|
||||||
send the go-ahead message when they connect */
|
send the go-ahead message when they connect */
|
||||||
static void local_socket_ready_notify(asocket* s) {
|
static void local_socket_ready_notify(asocket* s) {
|
||||||
|
|
@ -584,8 +585,6 @@ static unsigned unhex(const char* s, int len) {
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ADB_HOST
|
|
||||||
|
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
|
||||||
// Parses a host service string of the following format:
|
// Parses a host service string of the following format:
|
||||||
|
|
@ -714,15 +713,11 @@ bool parse_host_service(std::string_view* out_serial, std::string_view* out_comm
|
||||||
|
|
||||||
} // namespace internal
|
} // namespace internal
|
||||||
|
|
||||||
#endif // ADB_HOST
|
|
||||||
|
|
||||||
static int smart_socket_enqueue(asocket* s, apacket::payload_type data) {
|
static int smart_socket_enqueue(asocket* s, apacket::payload_type data) {
|
||||||
#if ADB_HOST
|
|
||||||
std::string_view service;
|
std::string_view service;
|
||||||
std::string_view serial;
|
std::string_view serial;
|
||||||
TransportId transport_id = 0;
|
TransportId transport_id = 0;
|
||||||
TransportType type = kTransportAny;
|
TransportType type = kTransportAny;
|
||||||
#endif
|
|
||||||
|
|
||||||
D("SS(%d): enqueue %zu", s->id, data.size());
|
D("SS(%d): enqueue %zu", s->id, data.size());
|
||||||
|
|
||||||
|
|
@ -755,7 +750,6 @@ static int smart_socket_enqueue(asocket* s, apacket::payload_type data) {
|
||||||
|
|
||||||
D("SS(%d): '%s'", s->id, (char*)(s->smart_socket_data.data() + 4));
|
D("SS(%d): '%s'", s->id, (char*)(s->smart_socket_data.data() + 4));
|
||||||
|
|
||||||
#if ADB_HOST
|
|
||||||
service = std::string_view(s->smart_socket_data).substr(4);
|
service = std::string_view(s->smart_socket_data).substr(4);
|
||||||
|
|
||||||
// TODO: These should be handled in handle_host_request.
|
// TODO: These should be handled in handle_host_request.
|
||||||
|
|
@ -841,16 +835,6 @@ static int smart_socket_enqueue(asocket* s, apacket::payload_type data) {
|
||||||
s2->ready(s2);
|
s2->ready(s2);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#else /* !ADB_HOST */
|
|
||||||
if (s->transport == nullptr) {
|
|
||||||
std::string error_msg = "unknown failure";
|
|
||||||
s->transport = acquire_one_transport(kTransportAny, nullptr, 0, nullptr, &error_msg);
|
|
||||||
if (s->transport == nullptr) {
|
|
||||||
SendFail(s->peer->fd, error_msg);
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!s->transport) {
|
if (!s->transport) {
|
||||||
SendFail(s->peer->fd, "device offline (no transport)");
|
SendFail(s->peer->fd, "device offline (no transport)");
|
||||||
|
|
@ -922,6 +906,7 @@ void connect_to_smartsocket(asocket* s) {
|
||||||
ss->peer = s;
|
ss->peer = s;
|
||||||
s->ready(s);
|
s->ready(s);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
size_t asocket::get_max_payload() const {
|
size_t asocket::get_max_payload() const {
|
||||||
size_t max_payload = MAX_PAYLOAD;
|
size_t max_payload = MAX_PAYLOAD;
|
||||||
|
|
|
||||||
|
|
@ -928,6 +928,7 @@ static void transport_destroy(atransport* t) {
|
||||||
remove_transport(t);
|
remove_transport(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if ADB_HOST
|
||||||
static int qual_match(const std::string& to_test, const char* prefix, const std::string& qual,
|
static int qual_match(const std::string& to_test, const char* prefix, const std::string& qual,
|
||||||
bool sanitize_qual) {
|
bool sanitize_qual) {
|
||||||
if (to_test.empty()) /* Return true if both the qual and to_test are empty strings. */
|
if (to_test.empty()) /* Return true if both the qual and to_test are empty strings. */
|
||||||
|
|
@ -1083,10 +1084,13 @@ void ConnectionWaitable::SetConnectionEstablished(bool success) {
|
||||||
}
|
}
|
||||||
cv_.notify_one();
|
cv_.notify_one();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
atransport::~atransport() {
|
atransport::~atransport() {
|
||||||
|
#if ADB_HOST
|
||||||
// If the connection callback had not been run before, run it now.
|
// If the connection callback had not been run before, run it now.
|
||||||
SetConnectionEstablished(false);
|
SetConnectionEstablished(false);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int atransport::Write(apacket* p) {
|
int atransport::Write(apacket* p) {
|
||||||
|
|
@ -1240,6 +1244,7 @@ void atransport::RunDisconnects() {
|
||||||
disconnects_.clear();
|
disconnects_.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if ADB_HOST
|
||||||
bool atransport::MatchesTarget(const std::string& target) const {
|
bool atransport::MatchesTarget(const std::string& target) const {
|
||||||
if (!serial.empty()) {
|
if (!serial.empty()) {
|
||||||
if (target == serial) {
|
if (target == serial) {
|
||||||
|
|
@ -1283,8 +1288,6 @@ ReconnectResult atransport::Reconnect() {
|
||||||
return reconnect_(this);
|
return reconnect_(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ADB_HOST
|
|
||||||
|
|
||||||
// We use newline as our delimiter, make sure to never output it.
|
// We use newline as our delimiter, make sure to never output it.
|
||||||
static std::string sanitize(std::string str, bool alphanumeric) {
|
static std::string sanitize(std::string str, bool alphanumeric) {
|
||||||
auto pred = alphanumeric ? [](const char c) { return !isalnum(c); }
|
auto pred = alphanumeric ? [](const char c) { return !isalnum(c); }
|
||||||
|
|
@ -1366,7 +1369,7 @@ void close_usb_devices(std::function<bool(const atransport*)> predicate, bool re
|
||||||
void close_usb_devices(bool reset) {
|
void close_usb_devices(bool reset) {
|
||||||
close_usb_devices([](const atransport*) { return true; }, reset);
|
close_usb_devices([](const atransport*) { return true; }, reset);
|
||||||
}
|
}
|
||||||
#endif // ADB_HOST
|
#endif
|
||||||
|
|
||||||
bool register_socket_transport(unique_fd s, std::string serial, int port, int local,
|
bool register_socket_transport(unique_fd s, std::string serial, int port, int local,
|
||||||
atransport::ReconnectCallback reconnect, bool use_tls, int* error) {
|
atransport::ReconnectCallback reconnect, bool use_tls, int* error) {
|
||||||
|
|
@ -1406,7 +1409,9 @@ bool register_socket_transport(unique_fd s, std::string serial, int port, int lo
|
||||||
|
|
||||||
lock.unlock();
|
lock.unlock();
|
||||||
|
|
||||||
|
#if ADB_HOST
|
||||||
auto waitable = t->connection_waitable();
|
auto waitable = t->connection_waitable();
|
||||||
|
#endif
|
||||||
register_transport(t);
|
register_transport(t);
|
||||||
|
|
||||||
if (local == 1) {
|
if (local == 1) {
|
||||||
|
|
@ -1414,6 +1419,7 @@ bool register_socket_transport(unique_fd s, std::string serial, int port, int lo
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if ADB_HOST
|
||||||
if (!waitable->WaitForConnection(std::chrono::seconds(10))) {
|
if (!waitable->WaitForConnection(std::chrono::seconds(10))) {
|
||||||
if (error) *error = ETIMEDOUT;
|
if (error) *error = ETIMEDOUT;
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -1423,6 +1429,7 @@ bool register_socket_transport(unique_fd s, std::string serial, int port, int lo
|
||||||
if (error) *error = EPERM;
|
if (error) *error = EPERM;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -1453,14 +1460,9 @@ void kick_all_tcp_devices() {
|
||||||
t->Kick();
|
t->Kick();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if ADB_HOST
|
|
||||||
reconnect_handler.CheckForKicked();
|
reconnect_handler.CheckForKicked();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if ADB_HOST
|
|
||||||
void register_usb_transport(usb_handle* usb, const char* serial, const char* devpath,
|
void register_usb_transport(usb_handle* usb, const char* serial, const char* devpath,
|
||||||
unsigned writeable) {
|
unsigned writeable) {
|
||||||
atransport* t = new atransport(writeable ? kCsOffline : kCsNoPerm);
|
atransport* t = new atransport(writeable ? kCsOffline : kCsNoPerm);
|
||||||
|
|
@ -1482,9 +1484,7 @@ void register_usb_transport(usb_handle* usb, const char* serial, const char* dev
|
||||||
|
|
||||||
register_transport(t);
|
register_transport(t);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#if ADB_HOST
|
|
||||||
// This should only be used for transports with connection_state == kCsNoPerm.
|
// This should only be used for transports with connection_state == kCsNoPerm.
|
||||||
void unregister_usb_transport(usb_handle* usb) {
|
void unregister_usb_transport(usb_handle* usb) {
|
||||||
std::lock_guard<std::recursive_mutex> lock(transport_lock);
|
std::lock_guard<std::recursive_mutex> lock(transport_lock);
|
||||||
|
|
|
||||||
|
|
@ -262,9 +262,12 @@ class atransport : public enable_weak_from_this<atransport> {
|
||||||
: id(NextTransportId()),
|
: id(NextTransportId()),
|
||||||
kicked_(false),
|
kicked_(false),
|
||||||
connection_state_(state),
|
connection_state_(state),
|
||||||
connection_waitable_(std::make_shared<ConnectionWaitable>()),
|
|
||||||
connection_(nullptr),
|
connection_(nullptr),
|
||||||
reconnect_(std::move(reconnect)) {
|
reconnect_(std::move(reconnect)) {
|
||||||
|
#if ADB_HOST
|
||||||
|
connection_waitable_ = std::make_shared<ConnectionWaitable>();
|
||||||
|
#endif
|
||||||
|
|
||||||
// Initialize protocol to min version for compatibility with older versions.
|
// Initialize protocol to min version for compatibility with older versions.
|
||||||
// Version will be updated post-connect.
|
// Version will be updated post-connect.
|
||||||
protocol_version = A_VERSION_MIN;
|
protocol_version = A_VERSION_MIN;
|
||||||
|
|
@ -350,6 +353,7 @@ class atransport : public enable_weak_from_this<atransport> {
|
||||||
void RemoveDisconnect(adisconnect* disconnect);
|
void RemoveDisconnect(adisconnect* disconnect);
|
||||||
void RunDisconnects();
|
void RunDisconnects();
|
||||||
|
|
||||||
|
#if ADB_HOST
|
||||||
// Returns true if |target| matches this transport. A matching |target| can be any of:
|
// Returns true if |target| matches this transport. A matching |target| can be any of:
|
||||||
// * <serial>
|
// * <serial>
|
||||||
// * <devpath>
|
// * <devpath>
|
||||||
|
|
@ -374,6 +378,7 @@ class atransport : public enable_weak_from_this<atransport> {
|
||||||
|
|
||||||
// Attempts to reconnect with the underlying Connection.
|
// Attempts to reconnect with the underlying Connection.
|
||||||
ReconnectResult Reconnect();
|
ReconnectResult Reconnect();
|
||||||
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::atomic<bool> kicked_;
|
std::atomic<bool> kicked_;
|
||||||
|
|
@ -392,9 +397,11 @@ class atransport : public enable_weak_from_this<atransport> {
|
||||||
std::deque<std::shared_ptr<RSA>> keys_;
|
std::deque<std::shared_ptr<RSA>> keys_;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if ADB_HOST
|
||||||
// A sharable object that can be used to wait for the atransport's
|
// A sharable object that can be used to wait for the atransport's
|
||||||
// connection to be established.
|
// connection to be established.
|
||||||
std::shared_ptr<ConnectionWaitable> connection_waitable_;
|
std::shared_ptr<ConnectionWaitable> connection_waitable_;
|
||||||
|
#endif
|
||||||
|
|
||||||
// The underlying connection object.
|
// The underlying connection object.
|
||||||
std::shared_ptr<Connection> connection_ GUARDED_BY(mutex_);
|
std::shared_ptr<Connection> connection_ GUARDED_BY(mutex_);
|
||||||
|
|
@ -434,10 +441,17 @@ void init_reconnect_handler(void);
|
||||||
void init_transport_registration(void);
|
void init_transport_registration(void);
|
||||||
void init_mdns_transport_discovery(void);
|
void init_mdns_transport_discovery(void);
|
||||||
std::string list_transports(bool long_listing);
|
std::string list_transports(bool long_listing);
|
||||||
|
|
||||||
|
#if ADB_HOST
|
||||||
atransport* find_transport(const char* serial);
|
atransport* find_transport(const char* serial);
|
||||||
|
|
||||||
void kick_all_tcp_devices();
|
void kick_all_tcp_devices();
|
||||||
|
#endif
|
||||||
|
|
||||||
void kick_all_transports();
|
void kick_all_transports();
|
||||||
|
|
||||||
void kick_all_tcp_tls_transports();
|
void kick_all_tcp_tls_transports();
|
||||||
|
|
||||||
#if !ADB_HOST
|
#if !ADB_HOST
|
||||||
void kick_all_transports_by_auth_key(std::string_view auth_key);
|
void kick_all_transports_by_auth_key(std::string_view auth_key);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -127,6 +127,7 @@ TEST_F(TransportTest, parse_banner_features) {
|
||||||
ASSERT_EQ(std::string("baz"), t.device);
|
ASSERT_EQ(std::string("baz"), t.device);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if ADB_HOST
|
||||||
TEST_F(TransportTest, test_matches_target) {
|
TEST_F(TransportTest, test_matches_target) {
|
||||||
std::string serial = "foo";
|
std::string serial = "foo";
|
||||||
std::string devpath = "/path/to/bar";
|
std::string devpath = "/path/to/bar";
|
||||||
|
|
@ -183,3 +184,4 @@ TEST_F(TransportTest, test_matches_target_local) {
|
||||||
EXPECT_FALSE(t.MatchesTarget("abc:100.100.100.100"));
|
EXPECT_FALSE(t.MatchesTarget("abc:100.100.100.100"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue