diff options
author | Tao Wu <lepton@google.com> | 2016-09-21 15:41:05 -0700 |
---|---|---|
committer | Tao Wu <lepton@google.com> | 2016-09-21 19:45:54 -0700 |
commit | 9b7341fe57ee9e4e95b111a14966107b3f0582d0 (patch) | |
tree | e059364b0b2e767fe8ae23df93845d85aa93ab47 | |
parent | 41595685482aec3ec4413c4e0bedf03c34a35a94 (diff) | |
download | system_core-9b7341fe57ee9e4e95b111a14966107b3f0582d0.tar.gz system_core-9b7341fe57ee9e4e95b111a14966107b3f0582d0.tar.bz2 system_core-9b7341fe57ee9e4e95b111a14966107b3f0582d0.zip |
We should break from loop after getting connected.
Now it always connects to multiple address of same host and just
return one socket while other sockets get leaked.
Also, it cause trouble on machine with dual stack.
adb connect localhost:* just connect to IPv4 and IPv6 at same time
and finally it doesn't work since emulator can only handle one adb
connection.
To test this, start an emulator with non-standar port and killall adb
daemon on linux work station and then do following test.
Test: adb connect localhost:12345;lsof -n -p `pgrep adb`
Change-Id: I1e0f6824efc1db8e179377de068e3b5535aff3f7
-rw-r--r-- | libcutils/socket_network_client_unix.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/libcutils/socket_network_client_unix.c b/libcutils/socket_network_client_unix.c index 46818d695..37851b17a 100644 --- a/libcutils/socket_network_client_unix.c +++ b/libcutils/socket_network_client_unix.c @@ -112,6 +112,7 @@ int socket_network_client_timeout(const char* host, int port, int type, int time } result = toggle_O_NONBLOCK(s); + break; } freeaddrinfo(addrs); |