mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 23:07:35 +00:00
Port the WindowServer and LibGUI to communicate through local sockets.
This is really cool! :^) Apps currently refuse to start if the WindowServer isn't listening on the socket in /wsportal. This makes sense, but I guess it would also be nice to have some sort of "wait for server on startup" mode. This has performance issues, and I'll work on those, but this stuff seems to actually work and I'm very happy with that.
This commit is contained in:
parent
00319c248c
commit
bf58241c11
15 changed files with 190 additions and 51 deletions
|
@ -19,13 +19,13 @@ public:
|
|||
int type() const { return m_type; }
|
||||
int protocol() const { return m_protocol; }
|
||||
|
||||
bool can_accept() const { return m_pending.is_empty(); }
|
||||
bool can_accept() const { return !m_pending.is_empty(); }
|
||||
RetainPtr<Socket> accept();
|
||||
|
||||
bool is_connected() const { return m_connected; }
|
||||
bool listen(int backlog, int& error);
|
||||
|
||||
virtual bool bind(const sockaddr*, socklen_t, int& error) = 0;
|
||||
virtual RetainPtr<Socket> connect(const sockaddr*, socklen_t, int& error) = 0;
|
||||
virtual bool connect(const sockaddr*, socklen_t, int& error) = 0;
|
||||
virtual bool get_address(sockaddr*, socklen_t*) = 0;
|
||||
virtual bool is_local() const { return false; }
|
||||
|
||||
|
@ -34,16 +34,22 @@ public:
|
|||
virtual ssize_t write(SocketRole, const byte*, size_t) = 0;
|
||||
virtual bool can_write(SocketRole) const = 0;
|
||||
|
||||
pid_t origin_pid() const { return m_origin_pid; }
|
||||
|
||||
protected:
|
||||
Socket(int domain, int type, int protocol);
|
||||
|
||||
bool queue_connection_from(Socket&, int& error);
|
||||
|
||||
private:
|
||||
Lock m_lock;
|
||||
pid_t m_origin_pid { 0 };
|
||||
int m_domain { 0 };
|
||||
int m_type { 0 };
|
||||
int m_protocol { 0 };
|
||||
int m_backlog { 0 };
|
||||
bool m_listening { false };
|
||||
bool m_connected { false };
|
||||
|
||||
Vector<RetainPtr<Socket>> m_pending;
|
||||
Vector<RetainPtr<Socket>> m_clients;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue