mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 08:36:15 +00:00
LibCore: Change Core::LocalServer::on_ready_to_accept => on_accept
Everyone used this hook in the same way: immediately accept() on the socket and then do something with the newly accepted fd. This patch simplifies the hook by having LocalServer do the accepting automatically.
This commit is contained in:
@@ -37,15 +37,10 @@ int main([[maybe_unused]] int argc, [[maybe_unused]] char** argv)
|
||||
bool ok = server->take_over_from_system_server();
|
||||
VERIFY(ok);
|
||||
|
||||
server->on_ready_to_accept = [&] {
|
||||
auto client_socket = server->accept();
|
||||
if (!client_socket) {
|
||||
dbgln("SQLServer: accept failed.");
|
||||
return;
|
||||
}
|
||||
server->on_accept = [&](auto client_socket) {
|
||||
static int s_next_client_id = 0;
|
||||
int client_id = ++s_next_client_id;
|
||||
IPC::new_client_connection<SQLServer::ClientConnection>(client_socket.release_nonnull(), client_id);
|
||||
IPC::new_client_connection<SQLServer::ClientConnection>(client_socket, client_id);
|
||||
};
|
||||
|
||||
return event_loop.exec();
|
||||
|
||||
Reference in New Issue
Block a user