Remove confusing variable HOST.
First, HOST is always 0 in adbd, which matches ADB_HOST=0.
Second, HOST is always 1 when adb_main is called, which matches ADB_HOST=1.
For adb client that doesn't call adb_main, it never touches local_init(),
init_transport_registration() and fdevent_loop(). So the changes in adb.cpp,
services.cpp and transport_local.cpp do nothing with it.
As a conclusion, I think we can remove HOST and use ADB_HOST instead.
Change-Id: Ide0e0eca7468b6c3c130f6b50974406280678b2e
diff --git a/adb/adb.cpp b/adb/adb.cpp
index 821b785..1f538c0 100644
--- a/adb/adb.cpp
+++ b/adb/adb.cpp
@@ -55,8 +55,6 @@
ADB_MUTEX_DEFINE(D_lock);
-int HOST = 0;
-
#if !ADB_HOST
const char* adb_device_banner = "device";
static android::base::LogdLogger gLogdLogger;
@@ -416,7 +414,9 @@
case A_SYNC:
if(p->msg.arg0){
send_packet(p, t);
- if(HOST) send_connect(t);
+#if ADB_HOST
+ send_connect(t);
+#endif
} else {
t->connection_state = kCsOffline;
handle_offline(t);
@@ -433,12 +433,16 @@
t->update_version(p->msg.arg0, p->msg.arg1);
parse_banner(reinterpret_cast<const char*>(p->data), t);
- if (HOST || !auth_required) {
+#if ADB_HOST
+ handle_online(t);
+#else
+ if (!auth_required) {
handle_online(t);
- if (!HOST) send_connect(t);
+ send_connect(t);
} else {
send_auth_request(t);
}
+#endif
break;
case A_AUTH: