The shutdown procedure for socket classes ensures that the I/O class is
deleted independently from its socket class. If the socket class has been
deleted, no I/O is performed and no socket events are forwarded. The I/O
class therefore doesn't require a strong reference to its socket class.
This patch removes the remaining ref-counted pointers from the socket I/O
classes. The socket class clears the weak reference in its socket I/O class
when closing the socket.
Dispatching events via |nsIThread| doesn't work with worker threads. This
patch replaces all uses of |nsIThread| in the socket code by equivalent
uses of |MessageLoop|.
The socket IPC interfaces still use 'main thread' in a number of
places. This patch changes all such interfaces and documentation
to speak of 'consumer thread' instead.
The consumer thread handles socket creation, destruction, and
data processing for socket IPC. Traditionally this has been
done on the main thread.
This patch extends the socket IPC classes to support arbitrary
consumer threads. The thread is configured when establishing a
connection, and performs all of the above operations until the
socket is closed.
The I/O thread sends and receives data on a file descriptor. This
has traditionally been performed on a single I/O thread.
This patch extends the socket IPC classes to support arbitrary I/O
threads. The thread is configured when a connection is established
and used until the socket gets closed.
Both types, |union sockaddr_any| and |struct sockaddr_storage|, provide
a sockaddr type that can hold any address. The latter is standardized by
POSIX, so we prefer it.
This patch converts |ListenSocket| to forward events to an instance
of |ListenSocketConsumer|. All users are converted and the related
listener and consumer classes are removed.
With this patch, stream and listening sockets handle the setup of
accepted sockets internally. Sub-classes of |StreamSocket| don't
have to overload StreamSocket's |GetIO| any longer.
This patch converts the socket I/O classes to use the new interface
of the socket-connector classes. All sockets are now created and set
up by a socket connector.
This patch converts the socket I/O classes to use the new interface
of the socket-connector classes. All sockets are now created and set
up by a socket connector.
This patch moves the code for setting socket flags in the socket I/O
classes to the few locations were sockets are created. Any other socket
setup is redundant and has been removed.
This patch cleans up the inherited methods of |ListenSocket|. Methods
of the same base class are grouped within the file, and each method is
labeled with 'override'.
This patch removes the template parameters from
|SocketIODeleteInstanceRunnable| and moves its methods into the
C++ source file. All users have been adapted.
This patch renames |SocketConsumerBase| to |DataSocket|, and for the
I/O classes |SocketConsumerIO| to |DataSocketIO|. |DataSocketIO| also
contains send and receive functionality from |SocketBaseIO|.
|DataSocket| is a virtual base class that represents a socket that
transfers data, without a particular constraints to what the data
represents. |DataSocketIO| is the corresponding helper class on the
I/O thread.
The listen socket will now send-out CONNECT_SUCCESS after it started
listening. Callers might rely on this event. Before, CONNECT_SUCCESS
in |ListenSocket| was not used by callers.
The new class |ListenSocket| listens on Unix sockets for incoming
connections. Accepted connections are handed over to a compatible
connection-oriented socket.