mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-12 11:09:18 +00:00
LibCore: Add initializer for LocalServer from already connected socket
This commit is contained in:
parent
4db0ec86c0
commit
70149079e4
Notes:
sideshowbarker
2024-07-17 16:23:55 +09:00
Author: https://github.com/ADKaster
Commit: 70149079e4
Pull-request: https://github.com/SerenityOS/serenity/pull/24126
Reviewed-by: https://github.com/trflynn89 ✅
2 changed files with 12 additions and 0 deletions
|
@ -47,6 +47,17 @@ ErrorOr<void> LocalServer::take_over_from_system_server(ByteString const& socket
|
|||
return {};
|
||||
}
|
||||
|
||||
ErrorOr<void> LocalServer::take_over_fd(int socket_fd)
|
||||
{
|
||||
if (m_listening)
|
||||
return Error::from_string_literal("Core::LocalServer: Can't perform socket takeover when already listening");
|
||||
|
||||
m_fd = socket_fd;
|
||||
m_listening = true;
|
||||
setup_notifier();
|
||||
return {};
|
||||
}
|
||||
|
||||
void LocalServer::setup_notifier()
|
||||
{
|
||||
m_notifier = Notifier::construct(m_fd, Notifier::Type::Read, this);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue