summaryrefslogtreecommitdiff
path: root/Userland/Services/LookupServer
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/LookupServer
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/LookupServer')
-rw-r--r--Userland/Services/LookupServer/LookupServer.cpp9
1 files changed, 2 insertions, 7 deletions
diff --git a/Userland/Services/LookupServer/LookupServer.cpp b/Userland/Services/LookupServer/LookupServer.cpp
index d973c06300..ae0e60398f 100644
--- a/Userland/Services/LookupServer/LookupServer.cpp
+++ b/Userland/Services/LookupServer/LookupServer.cpp
@@ -73,15 +73,10 @@ LookupServer::LookupServer()
m_mdns = MulticastDNS::construct(this);
m_local_server = Core::LocalServer::construct(this);
- m_local_server->on_ready_to_accept = [this]() {
- auto socket = m_local_server->accept();
- if (!socket) {
- dbgln("Failed to accept a client connection");
- return;
- }
+ m_local_server->on_accept = [this](auto client_socket) {
static int s_next_client_id = 0;
int client_id = ++s_next_client_id;
- IPC::new_client_connection<ClientConnection>(socket.release_nonnull(), client_id);
+ IPC::new_client_connection<ClientConnection>(move(client_socket), client_id);
};
bool ok = m_local_server->take_over_from_system_server();
VERIFY(ok);