Commit Graph

12 Commits

Author SHA1 Message Date
Andreas Kling
a1907011b2 CSocket: Don't create the read notifier until after we've connected
This makes it so that "on_connected" always gets called first.
Since accepted sockets are connected before construction, they have
to manually set CSocket::m_connected.
2019-09-22 21:46:46 +02:00
Andreas Kling
d6abfbdc5a LibCore: Remove ObjectPtr in favor of RefPtr
Now that CObject is fully ref-counted, just use RefPtr everywhere! :^)
2019-09-22 00:31:54 +02:00
Andreas Kling
d1bacb9885 LibCore: Convert CNotifier to ObjectPtr 2019-09-20 15:39:15 +02:00
Andreas Kling
99970d7d4b CSocket: Share code between connect() overloads
Both overloads should know how to set up a notifier callback in case
we get EINPROGRESS from connect().

It might be even better to merge the connect() overloads into a single
function..
2019-09-11 19:44:15 +02:00
Andreas Kling
e7957db173 LibCore: Remove CSocket's bind() and listen().
We're going to be using dedicated server socket classes instead.
This was only implemented for CLocalSocket, and clients have been switched
over to using CLocalServer.
2019-07-27 10:58:21 +02:00
Andreas Kling
82446ea701 CSocket: Add an on_ready_to_read callback.
This callback uses a CNotifier internally and will fire whenever there's
something to be read from the socket.
2019-07-27 10:48:43 +02:00
Andreas Kling
be2b585ca6 LibCore: Add CSocket::bind() (virtual) and CSocket::listen().
These will be useful for implementing server sockets.
2019-07-26 22:39:16 +02:00
Andreas Kling
a599317624 LibCore: Introduce a C_OBJECT macro.
This macro goes at the top of every CObject-derived class like so:

class SomeClass : public CObject {
    C_OBJECT(SomeClass)
public:
    ...

At the moment, all it does is create an override for the class_name() getter
but in the future this will be used to automatically insert member functions
into these classes.
2019-07-25 19:49:28 +02:00
Andreas Kling
16bcaf08a3 CSocket: Fix Clang warning about unused private member m_type. 2019-07-25 11:48:21 +02:00
Robin Burchell
a714fc661d LibCore: Add a way to mark a socket as blocking (or not)
If custom I/O is being done outside CIODevice, we need a way to force blocking sometimes.
This also fixes the default of CLocalSocket to be non-blocking, the same
as CTCPSocket.
2019-07-16 20:22:54 +02:00
Robin Burchell
ffa8cb668f AudioServer: Assorted infrastructure work
* Add a LibAudio, and move WAV file parsing there (via AWavFile and AWavLoader)
* Add CLocalSocket, and CSocket::connect() variant for local address types.
  We make some small use of this in WindowServer (as that's where we
  modelled it from), but don't get too invasive as this PR is already
  quite large, and the WS I/O is a bit carefully done
* Add an AClientConnection which will eventually be used to talk to
  AudioServer (and make use of it in Piano, though right now it really
  doesn't do anything except connect, using our new CLocalSocket...)
2019-07-13 22:57:24 +02:00
Andreas Kling
04b9dc2d30 Libraries: Create top level directory for libraries.
Things were getting a little crowded in the project root, so this patch
moves the Lib*/ directories into Libraries/.
2019-07-04 16:16:50 +02:00