summaryrefslogtreecommitdiff
path: root/Userland/Services/ConfigServer
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-11-29 18:42:01 +0100
committerAndreas Kling <kling@serenityos.org>2021-11-30 23:34:40 +0100
commitfe003939413d0de648618e2cd5f5c72182c7cf7b (patch)
treee75b7e24ca4df39d07a4cc23af30a47ee87bd9c3 /Userland/Services/ConfigServer
parent6cb3092b42132ab8ff59158e0b418a818c7ec315 (diff)
downloadserenity-fe003939413d0de648618e2cd5f5c72182c7cf7b.zip
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.
Diffstat (limited to 'Userland/Services/ConfigServer')
-rw-r--r--Userland/Services/ConfigServer/main.cpp9
1 files changed, 2 insertions, 7 deletions
diff --git a/Userland/Services/ConfigServer/main.cpp b/Userland/Services/ConfigServer/main.cpp
index ac97f033f1..3c4609e004 100644
--- a/Userland/Services/ConfigServer/main.cpp
+++ b/Userland/Services/ConfigServer/main.cpp
@@ -21,15 +21,10 @@ ErrorOr<int> serenity_main(Main::Arguments)
bool ok = server->take_over_from_system_server();
VERIFY(ok);
- server->on_ready_to_accept = [&] {
- auto client_socket = server->accept();
- if (!client_socket) {
- dbgln("ConfigServer: 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<ConfigServer::ClientConnection>(client_socket.release_nonnull(), client_id);
+ IPC::new_client_connection<ConfigServer::ClientConnection>(move(client_socket), client_id);
};
return event_loop.exec();