mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 10:47:44 +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:
parent
6cb3092b42
commit
fe00393941
11 changed files with 28 additions and 80 deletions
|
@ -83,8 +83,10 @@ void LocalServer::setup_notifier()
|
|||
{
|
||||
m_notifier = Notifier::construct(m_fd, Notifier::Event::Read, this);
|
||||
m_notifier->on_ready_to_read = [this] {
|
||||
if (on_ready_to_accept)
|
||||
on_ready_to_accept();
|
||||
if (on_accept) {
|
||||
if (auto client_socket = accept())
|
||||
on_accept(client_socket.release_nonnull());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue