Commit Graph

37 Commits

Author SHA1 Message Date
Chuck Lee
f3813df219 Bug 928223 - 0001. Add function to perform setup for listen socket. r=qDot echou vicamo yoshi 2013-10-25 10:00:22 +08:00
Thomas Zimmermann
fafde04f8a Bug 912996: Remove memcpy when reading from Unix socket, r=qdot
We used to allocate memory on the stack when reading from a file
descriptor and copied the result into an instance of UnixSocketRawData.

This patch

 - cleans up the interface of UnixSocketRawData,
 - removes the large stack allocation (64KiB), and
 - removes the unnecessary memcpy.

Other memcpys for sending data have been moved into the constructor
of UnixSocketRawData.
2013-09-06 10:18:35 +02:00
Thomas Zimmermann
96038c5a38 Bug 912996: Fix whitespaces, r=qdot 2013-09-06 10:17:55 +02:00
Eric Chou
06bffe2641 Bug 902460 - Close socket before NotifyError(), r=qdot 2013-08-27 12:10:48 +08:00
Justin Lebar
de89040a2c Bug 802686 - s/MOZ_NOT_REACHED/MOZ_CRASH/ in Gecko. r=(see below)
r=tbsaunde for accessible
r=jmuizelaar for gfx
r=roc for layout
r=glandium for mozglue
r=jduell for netwerk
r=khuey for everything else

This is a mechanical change made with sed.  Later patches in this queue
clean up the whitespace errors and so on.
2013-06-28 18:38:30 -07:00
Kyle Machulis
39925f14a1 Bug 854846: Make UnixSocket's connect function non-block; r=tzimmermann 2013-05-13 20:51:21 -07:00
Kyle Machulis
8baede483d Bug 855453 - Move UnixSocket connect delay to main thread cancelable task; r=mrbkap 2013-04-01 17:26:25 -07:00
Kyle Machulis
7727c9d17d Bug 843868: Change sockaddr* to be a union of all possible sockaddr types; r=tzimmermann 2013-03-19 10:23:47 -07:00
Eric Chou
d1bd564378 Bug 851563 - Fix memory leak in UnixSocketConsumer, r=qdot 2013-03-17 23:39:08 -07:00
Phil Ringnalda
55ae766272 Back out b21345c5027c (bug 843868) for build bustage
CLOSED TREE
2013-03-15 21:35:25 -07:00
Kyle Machulis
aac2cecd73 Bug 843868 - Change sockaddr* to be a union of all possible sockaddr types; r=tzimmermann 2013-03-15 21:10:40 -07:00
Kyle Machulis
a7e1d634e6 Bug 849078 - Change SetNonblockFlags to SetSocketFlags; r=echou 2013-03-08 14:40:26 -08:00
Blake Kaplan
4edf9e4537 Bug 846615 - Remove some functionality that is no longer needed, r=bent 2013-03-08 15:03:03 +08:00
Blake Kaplan
2edd0bd68d Bug 846615 - Re-implement UnixSocket's shutdown sequence to avoid running any code on deleted UnixSocketImpls, r=bent 2013-03-08 15:03:03 +08:00
Eric Chou
f3cdeb4552 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
Kyle Machulis
b69b55a00f Bug 840294: Check RIL validity before writing to socket; r=tzimmerman 2013-02-21 15:21:34 -08:00
Eric Chou
4c4bc329e2 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
0cb9436c17 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
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