mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 23:57:44 +00:00
LibIPC+Services: Make ClientConnection take socket as NonnullRefPtr
This avoids getting into the awkward situation where the socket is still part-owned by main() in multi-instance service. Also it just reads nicer.
This commit is contained in:
parent
f9d3055691
commit
94ddb07e58
25 changed files with 40 additions and 40 deletions
|
@ -33,8 +33,8 @@
|
|||
namespace LaunchServer {
|
||||
|
||||
static HashMap<int, RefPtr<ClientConnection>> s_connections;
|
||||
ClientConnection::ClientConnection(Core::LocalSocket& client_socket, int client_id)
|
||||
: IPC::ClientConnection<LaunchServerEndpoint>(*this, client_socket, client_id)
|
||||
ClientConnection::ClientConnection(NonnullRefPtr<Core::LocalSocket> client_socket, int client_id)
|
||||
: IPC::ClientConnection<LaunchServerEndpoint>(*this, move(client_socket), client_id)
|
||||
{
|
||||
s_connections.set(client_id, *this);
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ public:
|
|||
virtual void die() override;
|
||||
|
||||
private:
|
||||
explicit ClientConnection(Core::LocalSocket&, int client_id);
|
||||
explicit ClientConnection(NonnullRefPtr<Core::LocalSocket>, int client_id);
|
||||
|
||||
virtual OwnPtr<Messages::LaunchServer::GreetResponse> handle(const Messages::LaunchServer::Greet&) override;
|
||||
virtual OwnPtr<Messages::LaunchServer::OpenURLResponse> handle(const Messages::LaunchServer::OpenURL&) override;
|
||||
|
|
|
@ -61,7 +61,7 @@ int main(int argc, char** argv)
|
|||
static int s_next_client_id = 0;
|
||||
int client_id = ++s_next_client_id;
|
||||
dbg() << "Received connection";
|
||||
IPC::new_client_connection<LaunchServer::ClientConnection>(*client_socket, client_id);
|
||||
IPC::new_client_connection<LaunchServer::ClientConnection>(client_socket.release_nonnull(), client_id);
|
||||
};
|
||||
|
||||
return event_loop.exec();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue