ladybird/Libraries/LibCore/CLocalServer.h
Sergey Bugaev c9e21b2bcc SystemServer+LibCore: Implement socket takeover
SystemServer can now create sockets on behalf of services before spawning any
of them, and pass the open socket fd as fd 3. CLocalServer gains a method to
complete the takeover and listen on the passed fd.

This is not used by any services at the moment.
2019-11-26 19:58:25 +01:00

29 lines
604 B
C++

#pragma once
#include <LibCore/CNotifier.h>
#include <LibCore/CObject.h>
class CLocalSocket;
class CLocalServer : public CObject {
C_OBJECT(CLocalServer)
public:
virtual ~CLocalServer() override;
bool take_over_from_system_server();
bool is_listening() const { return m_listening; }
bool listen(const String& address);
RefPtr<CLocalSocket> accept();
Function<void()> on_ready_to_accept;
private:
explicit CLocalServer(CObject* parent = nullptr);
void setup_notifier();
int m_fd { -1 };
bool m_listening { false };
RefPtr<CNotifier> m_notifier;
};