Commit Graph

27 Commits

Author SHA1 Message Date
Eric Chou
1b5398a226 Bug 841648 - Clear mIOLoop when the UnixSocketImpl instance changes its target file descriptor, f=tzimmerman, r=qdot 2013-03-02 12:11:01 +08:00
Gregory Szorc
3dd52b1229 Bug 784841 - Part 18r: Convert /ipc; r=ted f=Ms2ger 2013-02-25 12:47:22 -08:00
Kyle Machulis
688f857918 Bug 840294: Check RIL validity before writing to socket; r=tzimmerman
--HG--
extra : rebase_source : 3fd48cad8cd3b06994972f420752c5676b2e68dc
2013-02-21 15:21:34 -08:00
Eric Chou
2cd94ed768 Bug 842434 - Ensure the flows of handling "socket disconnection" are the same, r=qdot
For "actively calling CloseSocket()" and "passively noticing the socket has been closed",
we want to ensure that the process of closing a socket are the same. Therefore I use a
runnable to call CloseSocket() on the main thread when it can't read from the socket.
2013-02-21 23:32:17 +08:00
Thomas Zimmermann
efaa88dd92 Bug 836523 - Cleanup UnixSocketImpl from within I/O thread. r=qdot, r=echou
When closing a socket from within the main thread, we need to make
sure that the I/O thread does not operate on the related instance of
UnixSocketImpl.

With this patch, the main thread posts a SocketCloseTask to the I/O
thread. The SocketCloseTask removes the socket from the I/O thread's
list of watched file descriptors and dispatches an instance of
DeleteInstanceRunnable for the socket's UnixSocketImpl, which cleans
up the data structures. These steps serialize the close operation
within the I/O thread, and ensure that the main thread processed all
other dispatched runnables that may use the UnixSocketImpl.
2013-02-12 09:16:45 -05:00
Thomas Zimmermann
750a662e60 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
03b6064933 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
0144abe74b Bug 838840: Mark ipc/unixsocket as FAIL_ON_WARNINGS. r=qDot 2013-02-06 16:39:36 -08:00
Daniel Holbert
f81c5f3831 Bug 838756: Fix out-of-order init list for UnixSocketImpl constructor. r=qDot 2013-02-06 12:44:04 -08:00
Vicamo Yang
ff9ad278f4 Bug 826931 - Part 2/3: UnixSocket - allow delayed connection. r=qDot 2013-02-01 20:28:18 +08:00
Vicamo Yang
20050ee452 Bug 826931 - Part 1/3: UnixSocket - allow ownership take-over in ReceiveSocketData(). r=qDot,echou 2013-02-01 20:28:15 +08:00
Eric Chou
21f9faaf65 Bug 836107 - Initialize mTask, a member variable of UnixSocketImpl, with nullptr, r=qdot 2013-01-31 22:43:45 +08:00
Benoit Jacob
1d6f2e71ed 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
dfe0efbdcd 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
6480dccd69 Bug 811683 - Changed UnixSocketRawData to take variable sizes up to 64k, r=cjones 2012-12-20 18:36:55 +08:00
Gina Yeh
5295f99641 Bug 804436 - Patch 1 : Add listening status to UnixSocket, r=gyeh 2012-10-26 17:28:34 +08:00
Kyle Machulis
108cfcce82 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
0ca2bf3025 Bug 800249 - Patch 1: Add ability to store/retrieve address to UnixSocket; r=cjones 2012-10-17 17:10:27 -07:00
Kyle Machulis
c9010dc7b5 Bug 800247: Add disconnect events to UnixSocket, update Bluetooth*Manager; r=echou r=cjones
--HG--
extra : rebase_source : 809d46954baea51bf4053c3a48ce45b18b1a58e9
2012-10-12 11:38:14 -07:00
Kyle Machulis
fb7564d911 Bug 796176 - Patch 1: UnixSocket changes to get connect/listen running main thread, connect status to consumers; r=cjones
--HG--
extra : rebase_source : 7fa0ed00a2c4ad526412af4ae0081818a547e5f3
2012-10-10 22:48:40 -07:00
Kyle Machulis
0e56497b27 Bug 796184 - Revert UnixSocketImpl to a bare pointer, make Bluetooth*Managers use CloseSocket; r=cjones r=gyeh
--HG--
extra : rebase_source : fe8f4633eb9fb86ffc4a87e6b483b3357ab9896d
2012-10-05 16:05:35 -07:00
Kyle Machulis
f6ccda89f3 Bug 790739: Patch 1 - UnixSocket changes for server sockets; r=cjones 2012-10-01 00:03:16 -07:00
Kyle Machulis
be72ab89b7 Backing out e8e7e0cf43d8 (Bug 790739) due to bustage
--HG--
extra : rebase_source : ab39dff4819b2a08bbc9696bfdca88b513fcb9c6
2012-09-30 23:17:46 -07:00
Kyle Machulis
03202f991e Bug 790739: Patch 1 - UnixSocket changes for server sockets; r=cjones 2012-09-30 22:54:27 -07:00
Kyle Machulis
753a29ed75 Bug 776182: Patch 3 - Socket I/O for ipc unix sockets; r=cjones r=echou
--HG--
rename : ipc/socket/Makefile.in => ipc/unixsocket/Makefile.in
rename : ipc/socket/Socket.cpp => ipc/unixsocket/UnixSocket.cpp
rename : ipc/socket/Socket.h => ipc/unixsocket/UnixSocket.h
extra : rebase_source : 18f401b047424a187863c9fbe8943364330d1f4d
2012-09-25 13:13:15 -07:00
Kyle Machulis
045e82f06b Bug 776182: Patch 2 - Move Socket.* to UnixSocket.*; r=cjones
--HG--
rename : ipc/socket/Socket.cpp => ipc/unixsocket/UnixSocket.cpp
rename : ipc/socket/Socket.h => ipc/unixsocket/UnixSocket.h
extra : rebase_source : 1e8da79be97c0e6f1a457276b209ff3b4d1193f6
2012-09-25 12:32:09 -07:00
Kyle Machulis
71716d84eb Bug 776182: Patch 1 - Move ipc/socket to ipc/unixsocket; r=cjones
--HG--
rename : ipc/socket/Makefile.in => ipc/unixsocket/Makefile.in
rename : ipc/socket/Socket.cpp => ipc/unixsocket/Socket.cpp
rename : ipc/socket/Socket.h => ipc/unixsocket/Socket.h
extra : rebase_source : ee6560813e80b834390a973c68147c2fc79e2aed
2012-09-25 12:31:22 -07:00