Commit Graph

129 Commits

Author SHA1 Message Date
Andrew Osmond
0c797b1728 Bug 1055316 - Fix unix socket connect backoff scheme such that it will actually backoff. r=tzimmermann 2014-08-18 15:53:00 -04:00
Thomas Zimmermann
2361eec5bb Bug 1048093: Delete sent socket-data objects instead of raw data, r=kyle
After successfully sending data, |SocketIOBase::SendPendingData|
deletes the raw data instead of the actual socket-data object. The
behavior is undefined and leads to a segmentation fault.

This patch fixes the bug by deleting the correct object.
2014-08-11 09:36:15 +02:00
Thomas Zimmermann
ea4744aa25 Bug 1046109: Cleanup |UnixSocketImpl|, r=kyle
This patch cleans up |UnixSocketImpl| and it's file in general. The
patch

 - renames |UnixSocketImpl| to |UnixSocketConsumerIO|,
 - moves method definitions out of class definition,
 - adds const correctness,
 - adds MOZ_FINAL to several classes,
 - moves task classes to a separate location.

No functional changes are performed.
2014-07-31 13:55:30 +02:00
Thomas Zimmermann
ae46aec1d3 Bug 1046109: Add |SocketIOShutdownTask|, r=kyle
|SocketIOShutdownTask| invokes the shutdown procedure for Socket I/O
objects on the I/O thread.
2014-07-31 13:55:30 +02:00
Thomas Zimmermann
e57e07d8d1 Bug 1046109: Add |SocketIOSendTask|, r=kyle
|SocketIOSendTask| moves data from the main thread to the Socket I/O
class on the I/O thread, and invokes the Socket I/O classes sending
methods.
2014-07-31 13:55:30 +02:00
Thomas Zimmermann
8f2f04ce2a Bug 1046109: Add |SocketIOTask|, r=kyle
|SocketIOTask| is a task-class template that holds a reference to
a Socket I/O object. It replaces |UnixSocketImplTask|, which only
supports objects of type |UnixSocketImpl|.
2014-07-31 13:55:29 +02:00
Thomas Zimmermann
5866e150ca Bug 1046109: Add |SocketIOBase|, r=kyle
|SocketIOBase| is a base class for Socket I/O classes. It's not a
requirement, but provides a number of helpful methods for common
I/O operations on the I/O thread.
2014-07-31 13:55:29 +02:00
Thomas Zimmermann
63e43f2cc7 Bug 1046109: Add |SocketIODeleteInstanceRunnable|, r=kyle
|SocketIODeleteInstanceRunnable| deletes a Socket I/O object on the
main thread. This is required to serialize the close operation of
Socket consumers.
2014-07-31 13:55:29 +02:00
Thomas Zimmermann
17664c3055 Bug 1046109: Add |SocketIORequestClosingRunnable|, r=kyle
|SocketIORequestClosingRunnable| notifies the Socket consumer on
the main thread to clean up the Socket I/O object and close the
connection.
2014-07-31 13:55:28 +02:00
Thomas Zimmermann
1e99e98b9c Bug 1046109: Add |SocketIOReceiveRunnable|, r=kyle
|SocketIOReceiveRunnable| sends received data from the Socket I/O
object on the I/O thread to the Socket consumer on the main thread.
2014-07-31 13:55:28 +02:00
Thomas Zimmermann
b7e43001ca Bug 1046109: Add |SocketIOEventRunnable|, r=kyle
|SocketIOEventRunnable| sends a notification from the Socket I/O
object to a Socket consumer on the main thread.
2014-07-31 13:55:28 +02:00
Thomas Zimmermann
244a4a0fdd Bug 1046109: Add |SocketIORunnable|, r=kyle
|SocketIORunnable| is a runnable class template that holds a
reference to a arbitrary Socket I/O object.  |SocketIORunnable|
replaces |UnixSocketImplRunnable|, which only handles objects of
type |UnixSocketImpl|.
2014-07-31 13:55:28 +02:00
Thomas Zimmermann
cf5074b5c5 Bug 1046109: Add |SocketConsumerBase| and inherit |UnixSocketConsumer| from it, r=kyle
|SocketConsumerBase| handles connection state for |UnixSocketConsumer|
and its derived classes. Implementing classes must override a number of
virtual methods, to handle notifications about changes to the state of
the connection.
2014-07-31 13:55:27 +02:00
Carsten "Tomcat" Book
e2967d912f Backed out changeset 56a5acbceadb (bug 1046109) for bustage on a CLOSED TREE 2014-07-31 10:14:57 +02:00
Carsten "Tomcat" Book
ce3f6eb5b2 Backed out changeset ddb118aa2648 (bug 1046109) 2014-07-31 10:14:34 +02:00
Carsten "Tomcat" Book
ec5c4dbe96 Backed out changeset 3b3966a2b854 (bug 1046109) 2014-07-31 10:14:32 +02:00
Carsten "Tomcat" Book
143d0f6822 Backed out changeset 38c914d4c7a7 (bug 1046109) 2014-07-31 10:14:30 +02:00
Carsten "Tomcat" Book
713f24ed6c Backed out changeset 795507bd02d3 (bug 1046109) 2014-07-31 10:14:29 +02:00
Carsten "Tomcat" Book
ff000e441e Backed out changeset be0077054b48 (bug 1046109) 2014-07-31 10:14:27 +02:00
Carsten "Tomcat" Book
5e3fd27081 Backed out changeset 0bf18526200b (bug 1046109) 2014-07-31 10:14:26 +02:00
Carsten "Tomcat" Book
ddee13a2ae Backed out changeset 9ef0211ae121 (bug 1046109) 2014-07-31 10:14:24 +02:00
Carsten "Tomcat" Book
484faca2f1 Backed out changeset 5314248e45b5 (bug 1046109) 2014-07-31 10:14:23 +02:00
Carsten "Tomcat" Book
a4bf4f800a Backed out changeset b20b097fde99 (bug 1046109) 2014-07-31 10:14:21 +02:00
Carsten "Tomcat" Book
cebdb18236 Backed out changeset 452a777db125 (bug 1046109) 2014-07-31 10:14:18 +02:00
Thomas Zimmermann
7dfd3fc360 Bug 1046109: Cleanup |UnixSocketImpl|, r=kyle
This patch cleans up |UnixSocketImpl| and it's file in general. The
patch

 - renames |UnixSocketImpl| to |UnixSocketConsumerIO|,
 - moves method definitions out of class definition,
 - adds const correctness,
 - adds MOZ_FINAL to several classes, and
 - moves task classes to a separate location.

No functional changes are performed.
2014-07-31 09:29:20 +02:00
Thomas Zimmermann
d4e730d905 Bug 1046109: Add |SocketIOShutdownTask|, r=kyle
|SocketIOShutdownTask| invokes the shutdown procedure for Socket I/O
objects on the I/O thread.
2014-07-31 09:29:20 +02:00
Thomas Zimmermann
f0e201cdc3 Bug 1046109: Add |SocketIOSendTask|, r=kyle
|SocketIOSendTask| moves data from the main thread to the Socket I/O
class on the I/O thread, and invokes the Socket I/O classes sending
methods.
2014-07-31 09:29:20 +02:00
Thomas Zimmermann
698aaed632 Bug 1046109: Add |SocketIOTask|, r=kyle
|SocketIOTask| is a task-class template that holds a reference to
a Socket I/O object. It replaces |UnixSocketImplTask|, which only
supports objects of type |UnixSocketImpl|.
2014-07-31 09:29:20 +02:00
Thomas Zimmermann
43583cc692 Bug 1046109: Add |SocketIOBase|, r=kyle
|SocketIOBase| is a base class for Socket I/O classes. It's not a
requirement, but provides a number of helpful methods for common
I/O operations on the I/O thread.
2014-07-31 09:29:19 +02:00
Thomas Zimmermann
ecd328b34b Bug 1046109: Add |SocketIODeleteInstanceRunnable|, r=kyle
|SocketIODeleteInstanceRunnable| deletes a Socket I/O object on the
main thread. This is required to serialize the close operation of
Socket consumers.
2014-07-31 09:29:19 +02:00
Thomas Zimmermann
2eb11e2b96 Bug 1046109: Add |SocketIORequestClosingRunnable|, r=kyle
|SocketIORequestClosingRunnable| notifies the Socket consumer on
the main thread to clean up the Socket I/O object and close the
connection.
2014-07-31 09:29:19 +02:00
Thomas Zimmermann
5bcb6a6ac5 Bug 1046109: Add |SocketIOReceiveRunnable|, r=kyle
|SocketIOReceiveRunnable| sends received data from the Socket I/O
object on the I/O thread to the Socket consumer on the main thread.
2014-07-31 09:29:18 +02:00
Thomas Zimmermann
f7d3ad8087 Bug 1046109: Add |SocketIOEventRunnable|, r=kyle
|SocketIOEventRunnable| sends a notification from the Socket I/O
object to a Socket consumer on the main thread.
2014-07-31 09:29:18 +02:00
Thomas Zimmermann
8cd8d45fd1 Bug 1046109: Add |SocketIORunnable|, r=kyle
|SocketIORunnable| is a runnable class template that holds a
reference to a arbitrary Socket I/O object.  |SocketIORunnable|
replaces |UnixSocketImplRunnable|, which only handles objects of
type |UnixSocketImpl|.
2014-07-31 09:29:18 +02:00
Thomas Zimmermann
2a41a6c122 Bug 1046109: Add |SocketConsumerBase| and inherit |UnixSocketConsumer| from it, r=kyle
|SocketConsumerBase| handles connection state for |UnixSocketConsumer|
and its derived classes. Implementing classes must override a number of
virtual methods, to handle notifications about changes to the state of
the connection.
2014-07-31 09:29:17 +02:00
Shelly Lin
d63debcb8f Bug 908995 - Part 3: Add source events for TaskTracer. r=khuey,smaug. 2014-04-23 15:32:31 +08:00
Kyle Huey
b6957123df Bug 991812: Remove uses of AtomicRefCounted<T> that live in Gecko. r=ehsan
--HG--
extra : rebase_source : 0d14e02c64d548fd3177681248d722683aaa87c3
2014-04-14 12:04:25 -07:00
Ryan VanderMeulen
601b02224e Backed out changesets ddbac34527fe and fa82f32d0c39 (bug 991812) for B2G bustage.
CLOSED TREE
2014-04-14 16:16:18 -04:00
Kyle Huey
acd8c16b76 Bug 991812: Remove uses of AtomicRefCounted<T> that live in Gecko. r=ehsan 2014-04-14 12:04:25 -07:00
Thomas Zimmermann
cab5fcb4dd Bug 990984: Explicitly close socket file descriptor, r=kyle
Closing the socket explicitly will make UnixSocket fail
if we're trying to read or write afterwards; indicating
potential bugs.
2014-04-08 09:30:58 +02:00
Thomas Zimmermann
88cf1c0e54 Bug 981239: Use atomic ref-counting for |UnixSocketConsumer|, r=kyle
|SocketSendTask| acquires a reference to |UnixSocketConsumer| on
the main thread and releases this reference on the I/O thread;
leading to race-conditions. This patch adds

  - atomicity for ref-counting of |UnixSocketConsumer|, and
  - stricter tests in the destructor of this class.
2014-04-08 09:27:47 +02:00
Ben Tian
506a83d68c Bug 979668 - [Bluetooth] Sender name is not shown in transfer requests, f=tzimmermann, r=kyle 2014-03-10 10:11:27 +08:00
Thomas Zimmermann
b8da10ea47 Bug 977672: Cleanup includes and defines in UnixSocket.cpp, r=kyle
The patch removes unnecessary includes and define statements from
UnixSocket.cpp.
2014-02-28 10:16:53 +01:00
Thomas Zimmermann
aeb9f13274 Bug 977672: Cleanup runnables and tasks in UnixSocket.cpp, r=kyle
This patch cleans up runnables and tasks in UnixSocket.cpp. Every
runnable's name now ends in Runnable. There are a base classes for
runnables and tasks that hold reference to UnixSocketImpl and from
which all runnables and tasks inherit.
2014-02-28 10:16:53 +01:00
Thomas Zimmermann
a3e0c85af9 Bug 977672: Assert O_NONBLOCK for watched file descriptors, r=kyle
We cannot use blocking file-descriptor I/O on the I/O thread. This
patch adds an assertion to UnixFdWatcher the tests for the O_NONBLOCK
flag, when installing a file descriptor. In UnixFileWatcher, the
Open method tests for the O_NONBLOCK flag for the opened file.

File-descriptor flags for UnixSocketImpl et al are currently set by
UnixSocketImpl itself. Later patches should move this into the
methods of connector classes.
2014-02-28 10:16:52 +01:00
Thomas Zimmermann
ceb3f29bcc Bug 974410: Cleanup UnixSocketImpl, r=kyle
This patch cleans up the implementation of UnixSocketImpl by

 - inlining all calls to SetUpIO,
 - removing the unsued constant SOCKET_RETRY_TIME_MS, and
 - separating logging from Bluetooth.
2014-02-26 17:52:18 +01:00
Thomas Zimmermann
928bfd8605 Bug 974410: Inherit UnixSocketImpl from UnixSocketWatcher, r=kyle
The base class UnixSocketWatcher handles the connection state of
the socket. UnixSocketImpl overrides UnixSocketWatcher's callback
methods for implementing it's functionality.
2014-02-26 17:52:09 +01:00
Thomas Zimmermann
aaab8a6062 Bug 974410: Inherit UnixSocketImpl from UnixFdWatcher, r=kyle
With this patch UnixSocketImpl inherits from UnixFdWatcher. The
new base class implements general file-descriptor handling and
I/O watchers.
2014-02-26 17:52:00 +01:00
Ehsan Akhgari
f1e844fd62 Bug 935778 - Part 0.4: Spray even more MOZ_DECLARE_REFCOUNTED_TYPENAME across the tree 2014-02-21 09:11:33 -05:00
Thomas Zimmermann
6d2e9a37cb Bug 972265: Maintain connect delay in UnixSocketConsumer, r=kyle
UnixSocketConsumer now maintains a delay for re-establishing closed
connection. The initial delay is zero, so that the first connect call
is processed immediately. At the first failed attempt to connect, the
delay is set to ~1 second, and is increased by a factor of 2 on each
successive error until it reaches ~1 minute.

The UnixSocketConsumer code resets the delay to zero if it is lower
than the time that the connection was open. This heuristics protects
against cases where the peer establishes a connection, and closes it
shortly afterwards. Incompatible versions of rild show this behavior.
2014-02-14 08:03:05 +01:00