Commit graph

71 commits

Author SHA1 Message Date
Jason Jeremy Iman
8bde191202 Enable "localfilesystem" UNIX domain socket for ADB.
This patch introduce "service.adb.listen_addrs", a new
string type property, while keeping the old properties.
The new property added in this patch is used to listen
on UNIX domain socket "localfilesystem".

"service.adb.listen_addrs" can be used to listen on
multiple addresses, such as tcp:5555 and tcp:5556.
It is separated by ',' (comma) character.

In the process of introducing the new socket type, the
method tcp_connect is removed and combined into
socket_spec_connect.

Without specifying using the new property, adb will
try to listen on both tcp and vsock (following the
previous implementation).

Some examples of the new property value are:
  - "tcp:5555"
  - "vsock:5555"
  - "localfilesystem:/tmp/test"
  - "tcp:5555,vsock:5555"

Bug: 133378083
Test: On master-arc-dev:
        adb root;
        setprop service.adb.listen_addrs localfilesystem:
	    <path_to_socket>;
        adb connect localfilesystem:<path_to_socket>;
        adb -s localfilesystem:<path_to_socket> shell;
	    inside Chrome OS.
Test: On aosp_bluefin:
        setprop service.adb.listen_addr tcp:5555;
        adb connect <IP>:5555; adb shell;
Test: On aosp_bluefin:
        setprop service.adb.tcp.port 5555;
        adb connect <IP>:5555; adb shell;
Test: On aosp_bluefin:
        setprop service.adb.listen_addrs tcp:5555,tcp:6666;
        adb connect <IP>:5555; adb shell;
        adb connect <IP>:6666; adb shell;
Test: On aosp_bluefin:
        ./adb_test;
Test: On cuttlefish:
        launch_cvd;
        adb -s 127.0.0.1:6520 shell;
Test: Ran host tests:
        ./adb_test;
        ./adb_integration_test_adb;
        ./adb_integration_test_device;

Change-Id: I8289bf0ab3305cf23ce5695ffba46845d58ef6bb
2019-12-04 10:05:05 +09:00
Yurii Zubrytskyi
5dda7f6cea [adb] Optimize adbd's usb reading
Try to not allocate as many blocks on the heap, and reuse
memory instead of copying it

Get rid of unique_ptr and shared_ptr where possible, move
the Block objects themselves

Overall this reduces the time spent in memcpy() from 30% to
15% of the whole 'adb push' command, and gets rid of about 5%
of the time spent in the malloc/free calls

Test: builds
Change-Id: I8995115274b6f08a4df13c58183c928ef384a767
2019-11-28 18:24:01 -08:00
Josh Gao
727b07b260 adb: fix old host transport selection.
We regressed handling of the old host transport selection syntax, which
broke users that reimplement adb themselves (e.g. Studio via ddmlib).

Bug: https://issuetracker.google.com/140369526
Test: adb raw "host-serial:822X0028S:forward:tcp:42929;localabstract:/com.example.ndktest-0/platform-1568299082100.sock"
Test: ./test_device.py
Change-Id: Iaaec8fde952316fe9bf2a6f6c6c4a3bc9f74bf72
2019-09-13 00:26:37 +08:00
Elliott Hughes
b4dc7be6c5 libbase: add ConsumePrefix/ConsumeSuffix.
adb was already using ConsumePrefix, and now we have another would-be
user in cutils. (There appears to be one place in adb that should use
ConsumeSuffix, so I'm assuming we'll want that sooner or later.)

I've kept these inline because adb and google3's versions both were, and
I'm easily led.

Test: treehugger
Change-Id: I29d99032f6f6ccbfaefece59725db8afb02a4c87
2019-05-03 12:49:31 -07:00
Josh Gao
43f3805950 adb: switch sockets.cpp to ConsumePrefix.
Test: mma
Change-Id: I86c3ec0fd90fe45e59c0187f664d46020bad2c0f
2019-02-25 13:59:00 -08:00
Josh Gao
79797ecbb1 adb: tell the client what transport it received.
Prerequisite for making `adb root` wait for the device that it told to
restart to disappear: the client needs to know which transport to wait
on.

Bug: http://b/124244488
Test: manual
Change-Id: I474559838ad7c0e961e9d2a98c902bca3b60d6c8
2019-02-25 13:49:25 -08:00
Josh Gao
0ecc4020d6 adb: switch host_service_to_socket to string_view.
Test: manual
Change-Id: I09b83cc82edb10c1a51ecc5ebb8d9fe5294222c3
2019-02-25 13:49:25 -08:00
Josh Gao
769f853f96 adb: switch handle_host_request to string_view.
Test: test_adb.py
Test: test_device.py
Change-Id: Ideae5262a6dff2e27c50f666144d48f874837290
2019-02-25 13:49:25 -08:00
Josh Gao
74b7ec72f8 adb: don't close sockets before hitting EOF.
Reimplement commit ffc11d3cf3 using
fdevent. The previous attempt was reverted because we were blindly
continuing when revents & POLLIN == 0, which ignored POLLHUP/POLLERR,
leading to spinloops when the opposite end of the file descriptor was
shutdown when we had no data left to read.

This patch reimplements the functionality implemented by that commit
using fdevent, which gets us detection of spin loops for free.

Bug: http://b/74616284
Test: ./test_device.py
Change-Id: I1abd671fef4c29e99dad968aa66bb754ca382578
2019-01-31 23:36:41 -08:00
Greg Kaiser
fdb9800fcc adb: Fix incorrect logging statement
We were logging "fd.get()" after we had already done a
"std::move(fd)".  That won't log the value we were hoping for.
We instead cache the file descriptor value in a local int prior
to the move(), and log that.

Test: TreeHugger
Change-Id: I715874ac63329280ffb55881fb2590fb31dc2457
2019-01-28 06:17:44 -08:00
Treehugger Robot
d290bb7ed8 Merge "Add native vsock support to ADB." 2019-01-26 05:25:28 +00:00
Cody Schuffelen
a05b64d432 Add native vsock support to ADB.
vsock is a socket address family for communicating into and out of
virtual machines. Addresses have a port and CID. The CID is unique to
each virtual machine on the computer. The VM host always has CID 2.
http://man7.org/linux/man-pages/man7/vsock.7.html

Inside the android guest, the adb daemon hosts a vsock server with
VMADDR_CID_ANY, automatically using the guest CID. The adb server
can now connect to addresses of the form vsock:cid:port, where the CID
must be specified and the port defaults to 5555.

This is a significant speed improvement for ADB connections in
Cuttlefish, with 150-200 MB/s for `adb push` and 100-150 MB/s for
`adb pull`. It also allows removing some proxying steps from Cuttlefish,
simplifying the full connection path, and removes a dependency on the
unstable ivshmem protocol.

Commands tested against a Cuttlefish VM with CID 3:
adb connect vsock:3:5555
adb -s vsock:3:5555 shell
adb disconnect vsock:3:5555

Supporting "adb disconnect" and "adb -s" required modifying some of the
parts that parse addresses / serials.

push/pull trials with native adb vsock support in cuttlefish:

100m: 1 file pushed. 297.6 MB/s (104857600 bytes in 0.336s)
100m: 1 file pushed. 270.3 MB/s (104857600 bytes in 0.370s)
100m: 1 file pushed. 271.7 MB/s (104857600 bytes in 0.368s)
100m: 1 file pushed. 250.5 MB/s (104857600 bytes in 0.399s)
100m: 1 file pushed. 277.1 MB/s (104857600 bytes in 0.361s)
100m: 1 file pushed. 263.5 MB/s (104857600 bytes in 0.379s)
100m: 1 file pushed. 242.6 MB/s (104857600 bytes in 0.412s)
100m: 1 file pushed. 271.8 MB/s (104857600 bytes in 0.368s)
100m: 1 file pushed. 267.1 MB/s (104857600 bytes in 0.374s)

/data/local/tmp/100m: 1 file pulled. 212.8 MB/s (104857600 bytes in 0.470s)
/data/local/tmp/100m: 1 file pulled. 236.7 MB/s (104857600 bytes in 0.423s)
/data/local/tmp/100m: 1 file pulled. 201.2 MB/s (104857600 bytes in 0.497s)
/data/local/tmp/100m: 1 file pulled. 255.6 MB/s (104857600 bytes in 0.391s)
/data/local/tmp/100m: 1 file pulled. 199.6 MB/s (104857600 bytes in 0.501s)
/data/local/tmp/100m: 1 file pulled. 214.6 MB/s (104857600 bytes in 0.466s)
/data/local/tmp/100m: 1 file pulled. 254.2 MB/s (104857600 bytes in 0.393s)
/data/local/tmp/100m: 1 file pulled. 212.5 MB/s (104857600 bytes in 0.471s)
/data/local/tmp/100m: 1 file pulled. 218.9 MB/s (104857600 bytes in 0.457s)
/data/local/tmp/100m: 1 file pulled. 223.6 MB/s (104857600 bytes in 0.447s)

Bug: 121166534
Change-Id: I50f21fb5c9acafb8daa789df4e28c9e1bbbbf2ef
Test: adb connect/shell/disconnect
2019-01-25 17:55:06 -08:00
Josh Gao
74ccdf984b adb: convert more stuff to unique_fd.
Test: adb_test
Test: adbd_test
Test: test_device.py
Change-Id: Ie75f0b811d2c75d508e6ecffb40579308f5789d0
2019-01-23 17:11:13 -08:00
Josh Gao
d0fa13e5f7 adb: switch connect_to_remote to string_view.
Test: test_adb.py
Test: test_device.py
Test: $ANDROID_HOST_OUT/nativetest64/adb_test/adb_test
Test: adb shell /data/nativetest64/adbd_test/adbd_test
Change-Id: Icce121a4c62bf0fa636a35bcae31d057cdff8fd2
2018-12-26 11:48:14 -08:00
Josh Gao
bd76720955 adb: switch skip_host_serial to string_view.
Rename it to something more appropriate, while we're at it.

Test: test_adb.py
Test: test_device.py
Test: $ANDROID_HOST_OUT/nativetest64/adb_test/adb_test
Test: adb shell /data/nativetest64/adbd_test/adbd_test
Change-Id: I0f95d348eeacb45a810696d748c8340d2068f666
2018-12-26 11:48:14 -08:00
Josh Gao
d19b77ac12 adb: finish switching service creation to string_view.
Test: test_adb.py
Test: test_device.py
Test: $ANDROID_HOST_OUT/nativetest64/adb_test/adb_test
Test: adb shell /data/nativetest64/adbd_test/adbd_test
Change-Id: If4ea92aee1c0264d946de72483f8d715d96fcfd8
2018-12-21 11:53:27 -08:00
Josh Gao
6eb788298b adbd: add source/sink services.
Add some services that skip the service fd to see how much of a benefit
it'll be to eliminate it.

Test: adb raw source:$((300 * 1024 * 1024)) | pv > /dev/null
Test: dd if=/dev/zero bs=1M count=100 | pv | adb raw sink:$((100 * 1024 * 1024))
Change-Id: I042f25f85b16ae9869cb1f1e306d8671b024ed97
2018-12-12 12:54:28 -08:00
Elliott Hughes
4679a39610 adb: rationalize fatal/error logging.
Let's use LOG(FATAL)/PLOG(FATAL) for actual fatal stuff.

Add a Windows error(3) and move folks who didn't really mean "abort"
fatal over to it. Also get rid of syntax_error which wasn't adding a
lot of value, and most of the places it was adding "usage: " didn't seem
entirely appropriate anyway.

In particular, we seemed to have confused fastdeploy.cpp into aborting
in most user error cases, and none of the reviewers noticed. Clearly
we'd all lost track of far too many options.

(I've also cleaned up a few random instances of fprintf(3) + exit(2).)

Bug: N/A
Test: manual
Change-Id: I3e8440848a24e30d928de9eded505916bc324786
2018-10-19 14:04:24 -07:00
Josh Gao
faf1328a64 Revert "adb: don't close sockets before hitting EOF."
This reverts commit ffc11d3cf3.

Reason for revert: DeviceIdleFreqCheckTest failing

Bug: http://b/117630047
Change-Id: Ia51a4a30e785bc5b2526695de3f442aac298198f
2018-10-12 05:08:45 +00:00
Josh Gao
ffc11d3cf3 adb: don't close sockets before hitting EOF.
The standard (RFC 1122 - 4.2.2.13) says that if we call close on a
socket while we have pending data, a TCP RST should be sent to the
other end to notify it that we didn't read all of its data. However,
this can result in data that we've succesfully written out to be dropped
on the other end. To avoid this, instead of immediately closing a
socket, call shutdown on it instead, and then read from the file
descriptor until we hit EOF or an error before closing.

Bug: http://b/74616284
Test: ./test_adb.py
Test: ./test_device.py
Change-Id: I36f72bd14965821dc23de82774b0806b2db24f13
2018-10-04 14:01:07 -07:00
Josh Gao
4039051d6d adb: clean up handle_host_request.
Previously, we were returning the result of SendOkay/SendFail in a few
places after handling a host request, which is incorrect for two
reasons. First, the return type of SendOkay/SendFail is bool, and
handle_host_request was expected to return 0 on success. Second, we
don't care if the SendOkay fails; if we got to that point, we're done
with the request, regardless of whether we succeeded to report our
result. The result of this was a spurious failure result reported after
the initial result, which was ignored by the adb client.

Test: manually straced adb server
Test: python test_adb.py
Test: python test_device.py
Change-Id: I7d45ba527e1faccbbae5b15e7a0d1557b0a84858
2018-08-07 14:24:36 -07:00
Yi Kong
aed415cc47 [adb] Modernize codebase by replacing NULL with nullptr
Fixes -Wzero-as-null-pointer-constant warning.

Test: m
Bug: 68236239
Change-Id: Ia8c4deacafed2f3b7dbc3d4c3c77c6c632e3de81
2018-07-13 18:21:00 -07:00
Josh Gao
7c738cdb53 adb: add IOVector.
An IOVector is a collection of immutable reference counted blocks which
can have its head detached at an arbitrary index. This is extremely
useful for implementing packet-framed protocols like adb on top of a
stream protocol like TCP: a stream reader can read blocks, append them
to the end of the IOVector, and then pull packets off of the front.
This also lends itself naturally towards scatter/gather I/O, which will
enable us to read data from disk and send it across the wire with a
theoretical minimum number of copies in USB, and one extra copy over
TCP.

Since this is basically a generalization of std::deque<Range>, delete
Range and replace its uses with IOVector.

Test: adb_test
Test: wine adb_test.exe
Change-Id: I06561ad0bb25a3a51b378b61d257b5b04b41d9c4
2018-05-23 11:26:04 -07:00
Josh Gao
7a223584c5 Merge changes I465804fd,Ib5a684bb,If5e66570,I8471cc00,I8ba0a70a
* changes:
  adb: convert fdevent over to unique_fd.
  adb: move towards using unique_fd.
  adb: delete FDEVENT_DONTCLOSE.
  adb: remove fdevent_install, fdevent_remove.
  adb: fix uninitialized variable in AsyncServiceRef.
2018-05-23 00:01:29 +00:00
Josh Gao
71f775a944 adb: remove fdevent_install, fdevent_remove.
Remove fdevent_install and fdevent_remove in favor of using
fdevent_create and fdevent_destroy, so that we can put RAII types (i.e.
unique_fd) into fdevent without worrying about -Wexit-time-destructors
or structs that are freed instead of deleted.

Bug: http://b/79786774
Test: python test_device.py
Change-Id: I8471cc00574ed492fe1b196944976cdaae8b7cff
2018-05-22 14:54:49 -07:00
Josh Gao
704494b070 adb: add authorizing, connecting states to transport.
Add two states: connecting and authorizing, to disambiguate the offline
and unauthorized states, respectively.

Previously, devices would transition as follows:

  offline -> unauthorized -> offline -> online
  offline -> unauthorized (when actually unauthorized)

With this patch:

  connecting -> authorizing -> online
  connecting -> authorizing -> unauthorized (when actually unauthorized)

This allows test automation and the like to distinguish between offline
devices, unauthorized devices, and working devices without having to
do retry loops with arbitrary sleeps on their end.

Bug: http://b/79257434
Test: adb_test
Test: adbd_test
Test: manually plugging in a device with `while true; do adb shell echo foo; done`
Change-Id: I036d9b593b51a27a59ac3fc57da966fd52658567
2018-05-04 18:05:18 -07:00
Josh Gao
44899eeb53 adb: fix adb reverse when adbd has multiple transports.
Plumb the transport that we received the adb reverse request on through
to reverse_service, instead of trying to get a unique transport on
devices that have multiple active transports (e.g. a device with USB
(even unplugged) connected via TCP).

Bug: http://b/37066218
Bug: http://b/71898863
Test: `echo foo | nc -l 12345 & adb reverse tcp:12345 tcp:12345; adb shell nc localhost 12345` on a device connected via TCP
Change-Id: Iae199ae787f2e344126bbcacca8544cfc9844a4c
2018-04-13 14:25:28 -07:00
Josh Gao
1ce99576f0 adb: switch apacket payload to a type that doesn't initialize its contents.
Switch from using std::string as the type we use to hold our payload in
apacket to a custom reimplementation that doesn't zero initialize. This
improves bulk transfer throughput in the adb_benchmark microbenchmark
on walleye by ~20%.

Test: adb shell taskset f0 /data/benchmarktest64/adb_benchmark/adb_benchmark
Change-Id: Ibad797701eb1460c9321b0400c5b167b89b2b4d0
2018-04-11 12:54:07 -07:00
Josh Gao
954e1280d7 adb: don't set has_write_error on success.
Whoops.

Test: adb_test
Change-Id: I32123c51446a22d4423eef0753b0a0b00b500a90
2018-04-02 14:18:27 -07:00
Josh Gao
184f480547 adb: don't immediately close a socket when write fails.
When we fail to write to a local socket peer, we might still have data
queued up to send to the other side. Defer closing the socket until
we've failed to both read and write.

Bug: http://b/74616284
Test: python test_device.py
Change-Id: Ifc4b8fe95369b4872e475c2ae4ee611dd2d8b9d7
2018-03-21 15:13:07 -07:00
Josh Gao
f571fcbe87 adb: switch apacket over to a std::string payload.
Test: python test_device.py with walleye/x86_64 emulator
Change-Id: I0a18941af1cb2279e5019a24ace25741def1202f
2018-02-21 14:30:17 -08:00
Josh Gao
e0361d1e90 adb: use delete on objects with destructors.
asocket has a destructor now, so we have to delete it, or leak the
data pointed to by its std::string.

Bug: http://b/73257049
Test: manual testing with asan
Change-Id: Ia88199292cc74e10032a9a16226d3afc61c3e0be
2018-02-12 17:31:39 -08:00
Josh Gao
27cb7dca77 adb: switch asocket::enqueue to std::string.
Switch asocket over to taking a std::string instead of apacket* for
data. This allows us to remove asocket specific fields from apacket*.

Test: python test_device.py with x86_64 emulator, walleye
Test: adb_test on host
Change-Id: I9d157ff331a75ba49a54fdd4194e3f6cdff722f4
2018-02-06 12:59:06 -08:00
Josh Gao
5e5076404a adb: switch asocket's intrusive linked list to vectors.
Test: python test_device.py
Change-Id: I24d7f5d0401de77d80c7a2dd5a7dcb551943342d
2018-02-06 12:59:06 -08:00
Josh Gao
62c92f0c05 adb: add lock to remove_socket.
The comment that was previously here says that local_socket_list_lock
must be taken, but this function is exposed to external callers that
can't possibly take the lock.

Bug: http://b/65419665
Test: python test_device.py
Change-Id: I12d464933936b2a210a827ccf19ea201020d8d78
2017-09-13 14:05:39 -07:00
Josh Gao
b122b17555 adb: allow selection of a specific transport.
Extend device selection to allow selecting a specific transport via
monotonically increasing identifier (visible in devices -l).

This is useful when using multiple devices (like hikey960...) that
have identical bogus serial numbers like 0123456789ABCDEF.

Bug: http://b/37043226
Test: adb -t {1, 2, 9999999} {get-serialno, shell, features}
Change-Id: I55e5dc5a406a4eeee0012e39b52e8cd232e608a6
2017-08-21 14:15:06 -07:00
Josh Gao
a019f78141 adb: increase the shell command length limit.
Relax the shell command length limits when talking to an adbd with the
shell protocol.

shell is pretty much the only service that takes an arbitrarily long
string, so this is somewhat safe.

Bug: http://b/37716055
Test: `adb shell $(python -c 'print "echo " + "f" * (32*1024)') | wc` on L and master
Change-Id: I0737fd2244530ef8080f300cd3a3549a1ab93465
2017-06-16 18:01:11 -07:00
Treehugger Robot
2e821078e4 Merge "adb: fix two device offline problems." 2017-04-20 19:45:18 +00:00
Yabin Cui
b5e11415d9 adb: fix two device offline problems.
When device goes offline, user usually has to manually replug the
usb device. This patch tries to solve two offline situations, all
because when adb on host is killed, the adbd on device is not notified.

1. When adb server is killed while pushing a large file to device,
the device is still reading the unfinished large message. So the
device thinks of the CNXN message as part of the previous unfinished
message, so it doesn't reply and the device is in offline state.

The solution is to add a write_msg_lock in atransport struct. And it
kicks the transport only after sending a whole message. By kicking
all transports before exit, we ensure that we don't write part of
a message to any device. So next time we start adb server, the device
should be waiting for a new message.

2. When adb server is killed while pulling a large file from device,
the device is still trying to send the unfinished large message. So
adb on host usually reads data with EOVERFLOW error. This is because
adb on host is reading less than one packet sent from device.

The solution is to use buffered read on host. The max packet size
of bulk transactions in USB 3.0 is 1024 bytes. By preparing an at least
1024 bytes buffer when reading, EOVERFLOW no longer occurs. And teach
adb host to ignore wrong messages.

To be safe, this patch doesn't change any logic on device.

Bug: http://b/32952319
Test: run python -m unittest -q test_device.DeviceOfflineTest
Test: on linux/mac/windows with bullhead, ryu.
Change-Id: Ib149d30028a62a6f03857b8a95ab5a1d6e9b9c4e
2017-04-20 10:14:59 -07:00
Steven Moreland
d73be1b96b libcutils: compile with BOARD_VNDK_VERSION current
- moved __android_log_is_debuggable to a new public header
    (log_properties.h)
- vendor version of sched_policy uses ALOG* instead SLOG*

Test: (sanity) liblog-unit-tests
Test: (sanity) libcutils_test (noting b/b/32972117, two tests continue
  to fail)
Test: system/core as a whole makes with BOARD_VNDK_VERSION := current
  now with no problems.
Test: boots/works on internal marlin
Bug: 33241851

(cherry picked from commit 1f83aa424f)

Merged-In: I5bc1f348dc0f0c8814bec5b5c3d2c52c825ab640
Change-Id: I5bc1f348dc0f0c8814bec5b5c3d2c52c825ab640
2017-04-17 14:44:17 -07:00
Josh Gao
22d2b3e1c2 adb: add adb reconnect offline to reconnect offline devices.
Add a command to reconnect offline/unauthorized devices, mainly for use
with the inotify-monitoring of vendor key directories added by 2e671202.

Bug: http://b/29273531
Test: manually tested with a sailfish + copying vendor keys
Change-Id: If34cccee4ae553ada65d128b57d03cba8c0d7c46
2016-10-27 17:13:23 -07:00
Mark Salyzyn
97787a00e6 adb: use __android_log_is_debuggable()
Test: compile and months of adb functionality use
Bug: 27566046
Bug: 31456426
Change-Id: I6568eea0eda8dc67dec2ba34cd4c3f56fb0ff0e9
2016-10-14 11:12:24 -07:00
Josh Gao
06d61d4d96 adb: rationalize types.
Use fixed length types for structs going over the wire, constify
arguments where possible, use char* instead of unsigned char* for
apacket data, and assorted other refactoring.

Bug: http://b/29273531
Test: python test_device.py with every combination of old/new adb and adbd
Change-Id: I0b6f818a32be5386985aa4519f542003cf427f9d
2016-10-06 14:50:02 -07:00
Treehugger Robot
b1c4d90215 Merge "adb: fix host-side serial number parsing for IPv6." 2016-09-28 17:30:29 +00:00
Elliott Hughes
ffdec18017 Switch adb to <android-base/properties.h>.
Bug: http://b/23102347
Test: manual
Change-Id: Iffa66258c01f84f41b9af99ab5e768a0a2669106
2016-09-26 13:14:14 -07:00
David Pursell
73d55aaab2 adb: fix host-side serial number parsing for IPv6.
When the adb client sends a command to the adb server targeting a
particular device serial, it looks something like this:
  host-serial:<serial>:<command>

But if <serial> happens to be an IPv6 address (e.g. when `adb connect`
targets IPv6), the current parsing code doesn't handle the additional
colons properly. This CL fixes the host-serial parsing to handle this
case.

This only affects commands that explicitly name a device serial, e.g.:
  adb -s <IPv6> shell
  adb -s <IPv6> forward <port> <port>
Implicitly using a single attached device was unaffected by this bug.

Bug: http://b/30891386
Test: `adb -s [fe80::ba27:ebff:feb1:934%eth2]:5555 shell` works now,
      and new unittests pass.
Change-Id: Iffe784e61432ae94eb96ed3c8477900a3e807329
2016-09-21 13:00:32 -07:00
Pirama Arumuga Nainar
7eaef8a494 Use <condition_variable> and <mutex.h> from MinGW
New MinGW prebuilts update includes pthreads and C++11 threads support.
Use mutex.h and condition_variable provided by MinGW.

Test: Build AOSP with new MinGW prebuilts
Change-Id: Ia8f890f86652612df3fc2618c2bfbb450a5a2f52
2016-09-06 13:49:07 -07:00
Elliott Hughes
ffc73a39fd Minor adb style fixes.
Change-Id: Ic4b45828dfdf88ef6c0fc468f66df3e62d2fbe51
2016-06-15 14:46:56 -07:00
Josh Gao
53eb31d87c adb: use asocket's close function when closing.
close_all_sockets was assuming that all registered local sockets used
local_socket_close as their close function. However, this is not true
for JDWP sockets.

Bug: http://b/28347842
Change-Id: I40a1174845cd33f15f30ce70828a7081cd5a087e
2016-05-18 14:21:53 -07:00
Josh Gao
9b587dec6d adb: switch the socket list mutex to a recursive_mutex.
sockets.cpp was branching on whether a socket close function was
local_socket_close in order to avoid a potential deadlock if the socket
list lock was held while closing a peer socket.

Bug: http://b/28347842
Change-Id: I5e56f17fa54275284787f0f1dc150d1960256ab3
2016-05-18 14:21:53 -07:00