summaryrefslogtreecommitdiff
path: root/client/main.cpp
diff options
context:
space:
mode:
authorDavid Pursell <dpursell@google.com>2016-04-07 11:25:48 -0700
committerDavid Pursell <dpursell@google.com>2016-05-09 16:55:10 -0700
commit6a9dc4e60509ceeef64509dff40296ca5c9c99a3 (patch)
tree721bbf170deaba71d54149bfb7be3382207156f0 /client/main.cpp
parenta0e2b442fa1c06efaa404d8fa2da89125e1e5c80 (diff)
downloadadb-6a9dc4e60509ceeef64509dff40296ca5c9c99a3.tar.gz
adb: support forwarding TCP port 0.
This CL adds support to forward or reverse TCP port 0 to allow the system to automatically select an open port. The resolved port number will be printed to stdout: $ adb forward tcp:0 tcp:8000 12345 $ adb reverse tcp:0 tcp:9000 23456 This allows testing to be more robust by not hardcoding TCP ports which may already be in use. Forwarding port 0 is a host-only change and will work with any device, but reversing port 0 requires the device to be updated with a new adbd binary. This CL also does a little bit of cleanup such as moving the alistener class out of adb.h, and adds some error checking and additional tests. Bug: 28051746 Test: python -m unittest discover Test: adb_test Test: `adb forward` and `adb reverse` with tcp:0 Change-Id: Icaa87346685b403ab5da7f0e6aa186aa091da572
Diffstat (limited to 'client/main.cpp')
-rw-r--r--client/main.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/client/main.cpp b/client/main.cpp
index 27b7109..65640ad 100644
--- a/client/main.cpp
+++ b/client/main.cpp
@@ -117,7 +117,7 @@ int adb_server_main(int is_daemon, int server_port, int ack_reply_fd) {
std::string error;
std::string local_name = android::base::StringPrintf("tcp:%d", server_port);
- if (install_listener(local_name, "*smartsocket*", nullptr, 0, &error)) {
+ if (install_listener(local_name, "*smartsocket*", nullptr, 0, nullptr, &error)) {
fatal("could not install *smartsocket* listener: %s", error.c_str());
}