diff options
author | Andreas Kling <kling@serenityos.org> | 2020-07-06 13:23:39 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-07-06 13:30:11 +0200 |
commit | 94ddb07e5884675d96a6938069fc3e83698dd898 (patch) | |
tree | be842856035e324b8907db26853dd98eba38fd26 /Services/NotificationServer | |
parent | f9d3055691c98940bbf43042b1859fbf7740924d (diff) | |
download | serenity-94ddb07e5884675d96a6938069fc3e83698dd898.zip |
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.
Diffstat (limited to 'Services/NotificationServer')
-rw-r--r-- | Services/NotificationServer/ClientConnection.cpp | 4 | ||||
-rw-r--r-- | Services/NotificationServer/ClientConnection.h | 2 | ||||
-rw-r--r-- | Services/NotificationServer/main.cpp | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/Services/NotificationServer/ClientConnection.cpp b/Services/NotificationServer/ClientConnection.cpp index 886f608624..f90878efe2 100644 --- a/Services/NotificationServer/ClientConnection.cpp +++ b/Services/NotificationServer/ClientConnection.cpp @@ -33,8 +33,8 @@ namespace NotificationServer { static HashMap<int, RefPtr<ClientConnection>> s_connections; -ClientConnection::ClientConnection(Core::LocalSocket& client_socket, int client_id) - : IPC::ClientConnection<NotificationServerEndpoint>(*this, client_socket, client_id) +ClientConnection::ClientConnection(NonnullRefPtr<Core::LocalSocket> client_socket, int client_id) + : IPC::ClientConnection<NotificationServerEndpoint>(*this, move(client_socket), client_id) { s_connections.set(client_id, *this); } diff --git a/Services/NotificationServer/ClientConnection.h b/Services/NotificationServer/ClientConnection.h index bec07fb127..8ea04bbfff 100644 --- a/Services/NotificationServer/ClientConnection.h +++ b/Services/NotificationServer/ClientConnection.h @@ -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::NotificationServer::GreetResponse> handle(const Messages::NotificationServer::Greet&) override; virtual OwnPtr<Messages::NotificationServer::ShowNotificationResponse> handle(const Messages::NotificationServer::ShowNotification&) override; diff --git a/Services/NotificationServer/main.cpp b/Services/NotificationServer/main.cpp index 1eb2152886..59fe6671be 100644 --- a/Services/NotificationServer/main.cpp +++ b/Services/NotificationServer/main.cpp @@ -52,7 +52,7 @@ int main(int argc, char** argv) } static int s_next_client_id = 0; int client_id = ++s_next_client_id; - IPC::new_client_connection<NotificationServer::ClientConnection>(*client_socket, client_id); + IPC::new_client_connection<NotificationServer::ClientConnection>(client_socket.release_nonnull(), client_id); }; if (unveil("/res", "r") < 0) { |