mirror of
https://github.com/RGBCube/serenity
synced 2025-05-25 11:45:07 +00:00
22 lines
670 B
C++
22 lines
670 B
C++
#include "ASEventLoop.h"
|
|
#include "ASClientConnection.h"
|
|
#include <sys/socket.h>
|
|
#include <sys/types.h>
|
|
#include <unistd.h>
|
|
|
|
ASEventLoop::ASEventLoop()
|
|
: m_server(CLocalServer::construct())
|
|
{
|
|
unlink("/tmp/asportal");
|
|
m_server->listen("/tmp/asportal");
|
|
m_server->on_ready_to_accept = [this] {
|
|
auto client_socket = m_server->accept();
|
|
if (!client_socket) {
|
|
dbg() << "AudioServer: accept failed.";
|
|
return;
|
|
}
|
|
static int s_next_client_id = 0;
|
|
int client_id = ++s_next_client_id;
|
|
IPC::Server::new_connection_ng_for_client<ASClientConnection>(*client_socket, client_id, m_mixer);
|
|
};
|
|
}
|