mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 04:07:45 +00:00
Make AClientConnection generic
This commit is contained in:
parent
3837de0573
commit
41bece0682
3 changed files with 174 additions and 148 deletions
|
@ -2,29 +2,15 @@
|
|||
|
||||
#include <LibCore/CLocalSocket.h>
|
||||
#include <LibCore/CNotifier.h>
|
||||
#include <LibCore/CIPCClientSideConnection.h>
|
||||
#include <LibAudio/ASAPI.h>
|
||||
|
||||
class ABuffer;
|
||||
|
||||
class AClientConnection {
|
||||
class AClientConnection : public CIPCClientSideConnection<ASAPI_ServerMessage, ASAPI_ClientMessage> {
|
||||
public:
|
||||
AClientConnection();
|
||||
|
||||
void send_greeting() override;
|
||||
void play(const ABuffer& buffer);
|
||||
|
||||
private:
|
||||
bool drain_messages_from_server();
|
||||
bool wait_for_specific_event(ASAPI_ServerMessage::Type type, ASAPI_ServerMessage& event);
|
||||
bool post_message_to_server(const ASAPI_ClientMessage& message, const ByteBuffer& extra_data = {});
|
||||
ASAPI_ServerMessage sync_request(const ASAPI_ClientMessage& request, ASAPI_ServerMessage::Type response_type);
|
||||
|
||||
CLocalSocket m_connection;
|
||||
CNotifier m_notifier;
|
||||
|
||||
struct IncomingASMessageBundle {
|
||||
ASAPI_ServerMessage message;
|
||||
ByteBuffer extra_data;
|
||||
};
|
||||
Vector<IncomingASMessageBundle> m_unprocessed_bundles;
|
||||
int m_server_pid;
|
||||
int m_my_client_id;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue