Commit Graph

69 Commits

Author SHA1 Message Date
Thomas Zimmermann
b9702b4f77 Bug 836523 - Wait for incoming connections in UnixSocketImpl. r=qdot, r=echou
The UnixSocketImpl currently polls the socket file descriptor while
listening for incoming connections and schedules itself to run again
if no connection requests have been received.

This behavior interferes with closing the socket and deleting the
socket structure in the main thread. It can happen that the I/O thread
dispatches a SocketAcceptTask to poll the listening socket and the
main thread dispatches a DeleteInstanceRunnable for the UnixSocketImpl,
such that the delete operation gets dispatched before the poll
operation. The latter then operates on the just deleted UnixSocketImpl.

With this patch, the I/O thread watches the listing socket for incoming
connection requests and only attempts to run accept when connection
requests are pending. This allows to serialize polling and close
operations within the I/O thread in a sound order.

A side effect of this patch is that we don't constantly run code for
polling the listing socket, which should result in less CPU overhead
and save battery power.
2013-02-12 09:16:45 -05:00
Thomas Zimmermann
bb354743ae Bug 836523 - Protect mCurrentTaskIsCanceled by lock. r=qdot, r=echou
The main thread and the I/O thread concurrently access the field
mCurrentTaskIsCanceled in UnixSocketImpl. Protect it by a lock.
2013-02-12 09:16:45 -05:00
Daniel Holbert
561e626085 Bug 838756: Fix out-of-order init list for UnixSocketImpl constructor. r=qDot 2013-02-06 12:44:04 -08:00
Vicamo Yang
0399c4e3a0 Bug 826931 - Part 2/3: UnixSocket - allow delayed connection. r=qDot 2013-02-01 20:28:18 +08:00
Eric Chou
3b85cbf018 Bug 836107 - Initialize mTask, a member variable of UnixSocketImpl, with nullptr, r=qdot 2013-01-31 22:43:45 +08:00
Benoit Jacob
6019c0d5f3 Bug 835920 - UnixSocket and Ril mis-interpret read() returning 0 as failure and enter infinite reconnect loop - r=kyle.machulis 2013-01-30 15:13:10 -05:00
Thomas Zimmermann
24c587ec34 Bug 830704: Delete UnixSocketImpl instance after SocketReceiveTasks completed [r=qdot]
The Bluetooth system internally uses UnixSocketImpl when transfering
files. When Bluetooth gets disabled during a file transfer, the IPC code
deletes any related instance of UnixSocketImpl. This can happen before all
pending SocketReceiveTasks have been processed by the main thread. The
implementation of SocketReceiveTask uses a reference to the instance of
UnixSocketImpl that has just deen disabled. This results in a segmantation
fault.

This patch fixes the problem by scheduling the delete operation for
UnixSocketImpl to be executed after any pending SocketReceiveTasks.
2013-01-16 10:21:49 +08:00
Kyle Machulis
d3f01c9b65 Bug 811683 - Changed UnixSocketRawData to take variable sizes up to 64k, r=cjones 2012-12-20 18:36:55 +08:00
Gina Yeh
e76ef0a220 Bug 804436 - Patch 1 : Add listening status to UnixSocket, r=gyeh 2012-10-26 17:28:34 +08:00
Kyle Machulis
c838b00979 Bug 800249 - Patch 2: Add ability to retreive connected socket address as a string; r=cjones 2012-10-17 17:11:05 -07:00
Kyle Machulis
863d03fc7d Bug 800249 - Patch 1: Add ability to store/retrieve address to UnixSocket; r=cjones 2012-10-17 17:10:27 -07:00
Kyle Machulis
ce973a704b Bug 800247: Add disconnect events to UnixSocket, update Bluetooth*Manager; r=echou r=cjones 2012-10-12 11:38:14 -07:00
Kyle Machulis
f28e7f6e44 Bug 796176 - Patch 1: UnixSocket changes to get connect/listen running main thread, connect status to consumers; r=cjones 2012-10-10 22:48:40 -07:00
Kyle Machulis
c84dfbb2a5 Bug 796184 - Revert UnixSocketImpl to a bare pointer, make Bluetooth*Managers use CloseSocket; r=cjones r=gyeh 2012-10-05 16:05:35 -07:00
Kyle Machulis
dc3e3c87a5 Bug 790739: Patch 1 - UnixSocket changes for server sockets; r=cjones 2012-10-01 00:03:16 -07:00
Kyle Machulis
cd306b0e65 Backing out e8e7e0cf43d8 (Bug 790739) due to bustage 2012-09-30 23:17:46 -07:00
Kyle Machulis
6b924d656a Bug 790739: Patch 1 - UnixSocket changes for server sockets; r=cjones 2012-09-30 22:54:27 -07:00
Kyle Machulis
215a8023d6 Bug 776182: Patch 3 - Socket I/O for ipc unix sockets; r=cjones r=echou 2012-09-25 13:13:15 -07:00
Kyle Machulis
242f67db8e Bug 776182: Patch 2 - Move Socket.* to UnixSocket.*; r=cjones 2012-09-25 12:32:09 -07:00