Issue
I found that the maximum number of devices connected to ADB through IP:PORT on my Linux server is 30 devices. I want to make this limit more, such as 1000 devices, by modifying the ADB source code. But I am from https://android .googlesource.com/platform/packages/modules/adb No 30 related codes were found in the downloaded source code. I tried to download more source code for ADB dependencies, but still can't find the relevant code. I don't know much about C language. Can someone give me some hints? Where should I find the code to limit the connection limit?
I'm downloading all the code for AOSP now, but it always fails because of network and hard disk space issues. I'm trying to figure out a way to fix it. If I download all the code for AOSP. Will it help me to solve this problem?
Solution
You don't have to change the source or recompile as it limit can be changed via an environment variable. Take a look at the code in adb:transport_local.cpp
static int adb_local_transport_max_port = DEFAULT_ADB_LOCAL_TRANSPORT_PORT + 16 * 2 - 1;
static std::mutex& local_transports_lock = *new std::mutex();
static void adb_local_transport_max_port_env_override() {
const char* env_max_s = getenv("ADB_LOCAL_TRANSPORT_MAX_PORT");
if (env_max_s != nullptr) {
size_t env_max;
if (ParseUint(&env_max, env_max_s, nullptr) && env_max < 65536) {
// < DEFAULT_ADB_LOCAL_TRANSPORT_PORT harmlessly mimics ADB_EMU=0
adb_local_transport_max_port = env_max;
D("transport: ADB_LOCAL_TRANSPORT_MAX_PORT read as %d", adb_local_transport_max_port);
} else {
D("transport: ADB_LOCAL_TRANSPORT_MAX_PORT '%s' invalid or >= 65536, so ignored",
env_max_s);
}
}
}
Answered By - Diego Torres Milano
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.