From 1ce03f4f341efd3a2543572c5a0816b65789b0b0 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 1 Feb 2021 11:26:41 +0100 Subject: [PATCH] LibIPC: Stop sending client ID to clients The client ID is not useful to normal clients anymore, so stop telling everyone what their ID is. --- Userland/DevTools/HackStudio/LanguageClient.h | 3 +-- .../HackStudio/LanguageServers/Cpp/ClientConnection.cpp | 2 +- .../DevTools/HackStudio/LanguageServers/LanguageServer.ipc | 2 +- .../HackStudio/LanguageServers/Shell/ClientConnection.cpp | 2 +- Userland/Libraries/LibAudio/ClientConnection.cpp | 3 +-- Userland/Libraries/LibDesktop/Launcher.cpp | 3 +-- Userland/Libraries/LibGUI/Clipboard.cpp | 3 +-- Userland/Libraries/LibGUI/Notification.cpp | 3 +-- Userland/Libraries/LibGUI/WindowServerConnection.cpp | 1 - Userland/Libraries/LibIPC/ServerConnection.h | 6 ------ Userland/Libraries/LibImageDecoderClient/Client.cpp | 3 +-- Userland/Libraries/LibProtocol/Client.cpp | 3 +-- Userland/Libraries/LibWeb/WebContentClient.cpp | 3 +-- Userland/Services/AudioServer/AudioServer.ipc | 2 +- Userland/Services/AudioServer/ClientConnection.cpp | 2 +- Userland/Services/Clipboard/ClientConnection.cpp | 2 +- Userland/Services/Clipboard/ClipboardServer.ipc | 2 +- Userland/Services/ImageDecoder/ClientConnection.cpp | 2 +- Userland/Services/ImageDecoder/ImageDecoderServer.ipc | 2 +- Userland/Services/LaunchServer/ClientConnection.cpp | 2 +- Userland/Services/LaunchServer/LaunchServer.ipc | 2 +- Userland/Services/NotificationServer/ClientConnection.cpp | 2 +- Userland/Services/NotificationServer/NotificationServer.ipc | 2 +- Userland/Services/ProtocolServer/ClientConnection.cpp | 2 +- Userland/Services/ProtocolServer/ProtocolServer.ipc | 2 +- Userland/Services/WebContent/ClientConnection.cpp | 2 +- Userland/Services/WebContent/WebContentServer.ipc | 2 +- Userland/Services/WindowServer/ClientConnection.cpp | 2 +- Userland/Services/WindowServer/WindowServer.ipc | 2 +- 29 files changed, 27 insertions(+), 42 deletions(-) diff --git a/Userland/DevTools/HackStudio/LanguageClient.h b/Userland/DevTools/HackStudio/LanguageClient.h index c24a9e9868..51804d8d0f 100644 --- a/Userland/DevTools/HackStudio/LanguageClient.h +++ b/Userland/DevTools/HackStudio/LanguageClient.h @@ -62,8 +62,7 @@ public: virtual void handshake() override { - auto response = send_sync(); - set_my_client_id(response->client_id()); + send_sync(); } WeakPtr language_client() { return m_language_client; } diff --git a/Userland/DevTools/HackStudio/LanguageServers/Cpp/ClientConnection.cpp b/Userland/DevTools/HackStudio/LanguageServers/Cpp/ClientConnection.cpp index c3cdedeef4..6403df4ec8 100644 --- a/Userland/DevTools/HackStudio/LanguageServers/Cpp/ClientConnection.cpp +++ b/Userland/DevTools/HackStudio/LanguageServers/Cpp/ClientConnection.cpp @@ -54,7 +54,7 @@ void ClientConnection::die() OwnPtr ClientConnection::handle(const Messages::LanguageServer::Greet&) { - return make(client_id()); + return make(); } class DefaultDocumentClient final : public GUI::TextDocument::Client { diff --git a/Userland/DevTools/HackStudio/LanguageServers/LanguageServer.ipc b/Userland/DevTools/HackStudio/LanguageServers/LanguageServer.ipc index 405dbbab88..ae4f55cf89 100644 --- a/Userland/DevTools/HackStudio/LanguageServers/LanguageServer.ipc +++ b/Userland/DevTools/HackStudio/LanguageServers/LanguageServer.ipc @@ -1,6 +1,6 @@ endpoint LanguageServer = 8001 { - Greet() => (i32 client_id) + Greet() => () FileOpened(String file_name, IPC::File file) =| FileEditInsertText(String file_name, String text, i32 start_line, i32 start_column) =| diff --git a/Userland/DevTools/HackStudio/LanguageServers/Shell/ClientConnection.cpp b/Userland/DevTools/HackStudio/LanguageServers/Shell/ClientConnection.cpp index 5f0e757a25..03948234c8 100644 --- a/Userland/DevTools/HackStudio/LanguageServers/Shell/ClientConnection.cpp +++ b/Userland/DevTools/HackStudio/LanguageServers/Shell/ClientConnection.cpp @@ -53,7 +53,7 @@ void ClientConnection::die() OwnPtr ClientConnection::handle(const Messages::LanguageServer::Greet&) { - return make(client_id()); + return make(); } class DefaultDocumentClient final : public GUI::TextDocument::Client { diff --git a/Userland/Libraries/LibAudio/ClientConnection.cpp b/Userland/Libraries/LibAudio/ClientConnection.cpp index 3cb3bd4627..aff4ab600a 100644 --- a/Userland/Libraries/LibAudio/ClientConnection.cpp +++ b/Userland/Libraries/LibAudio/ClientConnection.cpp @@ -36,8 +36,7 @@ ClientConnection::ClientConnection() void ClientConnection::handshake() { - auto response = send_sync(); - set_my_client_id(response->client_id()); + send_sync(); } void ClientConnection::enqueue(const Buffer& buffer) diff --git a/Userland/Libraries/LibDesktop/Launcher.cpp b/Userland/Libraries/LibDesktop/Launcher.cpp index 04e170745f..06e1caff01 100644 --- a/Userland/Libraries/LibDesktop/Launcher.cpp +++ b/Userland/Libraries/LibDesktop/Launcher.cpp @@ -60,8 +60,7 @@ class LaunchServerConnection : public IPC::ServerConnection(); - set_my_client_id(response->client_id()); + send_sync(); } private: diff --git a/Userland/Libraries/LibGUI/Clipboard.cpp b/Userland/Libraries/LibGUI/Clipboard.cpp index c54c69ff3c..f484005ae0 100644 --- a/Userland/Libraries/LibGUI/Clipboard.cpp +++ b/Userland/Libraries/LibGUI/Clipboard.cpp @@ -39,8 +39,7 @@ class ClipboardServerConnection : public IPC::ServerConnection(); - set_my_client_id(response->client_id()); + send_sync(); } private: diff --git a/Userland/Libraries/LibGUI/Notification.cpp b/Userland/Libraries/LibGUI/Notification.cpp index 19abfb12c6..51667d6a97 100644 --- a/Userland/Libraries/LibGUI/Notification.cpp +++ b/Userland/Libraries/LibGUI/Notification.cpp @@ -37,8 +37,7 @@ class NotificationServerConnection : public IPC::ServerConnection(); - set_my_client_id(response->client_id()); + send_sync(); } private: diff --git a/Userland/Libraries/LibGUI/WindowServerConnection.cpp b/Userland/Libraries/LibGUI/WindowServerConnection.cpp index 73e2715f28..62b11c4fe4 100644 --- a/Userland/Libraries/LibGUI/WindowServerConnection.cpp +++ b/Userland/Libraries/LibGUI/WindowServerConnection.cpp @@ -63,7 +63,6 @@ static void set_system_theme_from_anonymous_buffer(Core::AnonymousBuffer buffer) void WindowServerConnection::handshake() { auto response = send_sync(); - set_my_client_id(response->client_id()); set_system_theme_from_anonymous_buffer(response->theme_buffer()); Desktop::the().did_receive_screen_rect({}, response->screen_rect()); } diff --git a/Userland/Libraries/LibIPC/ServerConnection.h b/Userland/Libraries/LibIPC/ServerConnection.h index 5912bc006b..6f655d4c5b 100644 --- a/Userland/Libraries/LibIPC/ServerConnection.h +++ b/Userland/Libraries/LibIPC/ServerConnection.h @@ -49,17 +49,11 @@ public: virtual void handshake() = 0; - void set_my_client_id(int id) { m_my_client_id = id; } - int my_client_id() const { return m_my_client_id; } - virtual void die() override { // Override this function if you don't want your app to exit if it loses the connection. exit(0); } - -private: - int m_my_client_id { -1 }; }; } diff --git a/Userland/Libraries/LibImageDecoderClient/Client.cpp b/Userland/Libraries/LibImageDecoderClient/Client.cpp index cddd753f37..29455ef47b 100644 --- a/Userland/Libraries/LibImageDecoderClient/Client.cpp +++ b/Userland/Libraries/LibImageDecoderClient/Client.cpp @@ -37,8 +37,7 @@ Client::Client() void Client::handshake() { - auto response = send_sync(); - set_my_client_id(response->client_id()); + send_sync(); } void Client::handle(const Messages::ImageDecoderClient::Dummy&) diff --git a/Userland/Libraries/LibProtocol/Client.cpp b/Userland/Libraries/LibProtocol/Client.cpp index fc86a4622a..32d7f5c2b4 100644 --- a/Userland/Libraries/LibProtocol/Client.cpp +++ b/Userland/Libraries/LibProtocol/Client.cpp @@ -38,8 +38,7 @@ Client::Client() void Client::handshake() { - auto response = send_sync(); - set_my_client_id(response->client_id()); + send_sync(); } bool Client::is_supported_protocol(const String& protocol) diff --git a/Userland/Libraries/LibWeb/WebContentClient.cpp b/Userland/Libraries/LibWeb/WebContentClient.cpp index 99b9dd87ab..e72b536f9c 100644 --- a/Userland/Libraries/LibWeb/WebContentClient.cpp +++ b/Userland/Libraries/LibWeb/WebContentClient.cpp @@ -45,8 +45,7 @@ void WebContentClient::die() void WebContentClient::handshake() { - auto response = send_sync(); - set_my_client_id(response->client_id()); + send_sync(); } void WebContentClient::handle(const Messages::WebContentClient::DidPaint& message) diff --git a/Userland/Services/AudioServer/AudioServer.ipc b/Userland/Services/AudioServer/AudioServer.ipc index 1ae8ed8d9a..a52a837f41 100644 --- a/Userland/Services/AudioServer/AudioServer.ipc +++ b/Userland/Services/AudioServer/AudioServer.ipc @@ -1,7 +1,7 @@ endpoint AudioServer = 85 { // Basic protocol - Greet() => (i32 client_id) + Greet() => () // Mixer functions SetMuted(bool muted) => () diff --git a/Userland/Services/AudioServer/ClientConnection.cpp b/Userland/Services/AudioServer/ClientConnection.cpp index 773aa4ca86..e10db5949e 100644 --- a/Userland/Services/AudioServer/ClientConnection.cpp +++ b/Userland/Services/AudioServer/ClientConnection.cpp @@ -81,7 +81,7 @@ void ClientConnection::did_change_main_mix_volume(Badge, int volume) OwnPtr ClientConnection::handle(const Messages::AudioServer::Greet&) { - return make(client_id()); + return make(); } OwnPtr ClientConnection::handle(const Messages::AudioServer::GetMainMixVolume&) diff --git a/Userland/Services/Clipboard/ClientConnection.cpp b/Userland/Services/Clipboard/ClientConnection.cpp index 86ecba3616..d97f30eb0c 100644 --- a/Userland/Services/Clipboard/ClientConnection.cpp +++ b/Userland/Services/Clipboard/ClientConnection.cpp @@ -57,7 +57,7 @@ void ClientConnection::die() OwnPtr ClientConnection::handle(const Messages::ClipboardServer::Greet&) { - return make(client_id()); + return make(); } OwnPtr ClientConnection::handle(const Messages::ClipboardServer::SetClipboardData& message) diff --git a/Userland/Services/Clipboard/ClipboardServer.ipc b/Userland/Services/Clipboard/ClipboardServer.ipc index 2b38fc16fe..1c6372cb4e 100644 --- a/Userland/Services/Clipboard/ClipboardServer.ipc +++ b/Userland/Services/Clipboard/ClipboardServer.ipc @@ -1,6 +1,6 @@ endpoint ClipboardServer = 802 { - Greet() => (i32 client_id) + Greet() => () GetClipboardData() => (Core::AnonymousBuffer data, [UTF8] String mime_type, IPC::Dictionary metadata) SetClipboardData(Core::AnonymousBuffer data, [UTF8] String mime_type, IPC::Dictionary metadata) => () diff --git a/Userland/Services/ImageDecoder/ClientConnection.cpp b/Userland/Services/ImageDecoder/ClientConnection.cpp index 97fd11eb2f..fd10705aff 100644 --- a/Userland/Services/ImageDecoder/ClientConnection.cpp +++ b/Userland/Services/ImageDecoder/ClientConnection.cpp @@ -53,7 +53,7 @@ void ClientConnection::die() OwnPtr ClientConnection::handle(const Messages::ImageDecoderServer::Greet&) { - return make(client_id()); + return make(); } OwnPtr ClientConnection::handle(const Messages::ImageDecoderServer::DecodeImage& message) diff --git a/Userland/Services/ImageDecoder/ImageDecoderServer.ipc b/Userland/Services/ImageDecoder/ImageDecoderServer.ipc index c8d393ad4d..c2808822df 100644 --- a/Userland/Services/ImageDecoder/ImageDecoderServer.ipc +++ b/Userland/Services/ImageDecoder/ImageDecoderServer.ipc @@ -1,6 +1,6 @@ endpoint ImageDecoderServer = 7001 { - Greet() => (i32 client_id) + Greet() => () DecodeImage(Core::AnonymousBuffer data) => (bool is_animated, u32 loop_count, Vector bitmaps, Vector durations) } diff --git a/Userland/Services/LaunchServer/ClientConnection.cpp b/Userland/Services/LaunchServer/ClientConnection.cpp index 7ac167c1ae..0c32008613 100644 --- a/Userland/Services/LaunchServer/ClientConnection.cpp +++ b/Userland/Services/LaunchServer/ClientConnection.cpp @@ -50,7 +50,7 @@ void ClientConnection::die() OwnPtr ClientConnection::handle(const Messages::LaunchServer::Greet&) { - return make(client_id()); + return make(); } OwnPtr ClientConnection::handle(const Messages::LaunchServer::OpenURL& request) diff --git a/Userland/Services/LaunchServer/LaunchServer.ipc b/Userland/Services/LaunchServer/LaunchServer.ipc index 4f50221f4b..34ac5a6db3 100644 --- a/Userland/Services/LaunchServer/LaunchServer.ipc +++ b/Userland/Services/LaunchServer/LaunchServer.ipc @@ -1,6 +1,6 @@ endpoint LaunchServer = 101 { - Greet() => (i32 client_id) + Greet() => () OpenURL(URL url, String handler_name) => (bool response) GetHandlersForURL(URL url) => (Vector handlers) GetHandlersWithDetailsForURL(URL url) => (Vector handlers_details) diff --git a/Userland/Services/NotificationServer/ClientConnection.cpp b/Userland/Services/NotificationServer/ClientConnection.cpp index 9c6cc8051a..4cf70b6389 100644 --- a/Userland/Services/NotificationServer/ClientConnection.cpp +++ b/Userland/Services/NotificationServer/ClientConnection.cpp @@ -50,7 +50,7 @@ void ClientConnection::die() OwnPtr ClientConnection::handle(const Messages::NotificationServer::Greet&) { - return make(client_id()); + return make(); } OwnPtr ClientConnection::handle(const Messages::NotificationServer::ShowNotification& message) diff --git a/Userland/Services/NotificationServer/NotificationServer.ipc b/Userland/Services/NotificationServer/NotificationServer.ipc index e342ebf2d3..a4f7e64a6b 100644 --- a/Userland/Services/NotificationServer/NotificationServer.ipc +++ b/Userland/Services/NotificationServer/NotificationServer.ipc @@ -1,7 +1,7 @@ endpoint NotificationServer = 95 { // Basic protocol - Greet() => (i32 client_id) + Greet() => () ShowNotification([UTF8] String text, [UTF8] String title, Gfx::ShareableBitmap icon) => () } diff --git a/Userland/Services/ProtocolServer/ClientConnection.cpp b/Userland/Services/ProtocolServer/ClientConnection.cpp index 79dd09a651..555c441def 100644 --- a/Userland/Services/ProtocolServer/ClientConnection.cpp +++ b/Userland/Services/ProtocolServer/ClientConnection.cpp @@ -122,7 +122,7 @@ void ClientConnection::did_request_certificates(Badge, Download& downl OwnPtr ClientConnection::handle(const Messages::ProtocolServer::Greet&) { - return make(client_id()); + return make(); } OwnPtr ClientConnection::handle(const Messages::ProtocolServer::SetCertificate& message) diff --git a/Userland/Services/ProtocolServer/ProtocolServer.ipc b/Userland/Services/ProtocolServer/ProtocolServer.ipc index a89eab506b..3a8ecdabad 100644 --- a/Userland/Services/ProtocolServer/ProtocolServer.ipc +++ b/Userland/Services/ProtocolServer/ProtocolServer.ipc @@ -1,7 +1,7 @@ endpoint ProtocolServer = 9 { // Basic protocol - Greet() => (i32 client_id) + Greet() => () // Test if a specific protocol is supported, e.g "http" IsSupportedProtocol(String protocol) => (bool supported) diff --git a/Userland/Services/WebContent/ClientConnection.cpp b/Userland/Services/WebContent/ClientConnection.cpp index b680fad970..f800161533 100644 --- a/Userland/Services/WebContent/ClientConnection.cpp +++ b/Userland/Services/WebContent/ClientConnection.cpp @@ -78,7 +78,7 @@ const Web::Page& ClientConnection::page() const OwnPtr ClientConnection::handle(const Messages::WebContentServer::Greet&) { - return make(client_id()); + return make(); } void ClientConnection::handle(const Messages::WebContentServer::UpdateSystemTheme& message) diff --git a/Userland/Services/WebContent/WebContentServer.ipc b/Userland/Services/WebContent/WebContentServer.ipc index d598c4ea92..fd07091620 100644 --- a/Userland/Services/WebContent/WebContentServer.ipc +++ b/Userland/Services/WebContent/WebContentServer.ipc @@ -1,6 +1,6 @@ endpoint WebContentServer = 89 { - Greet() => (i32 client_id) + Greet() => () UpdateSystemTheme(Core::AnonymousBuffer theme_buffer) =| diff --git a/Userland/Services/WindowServer/ClientConnection.cpp b/Userland/Services/WindowServer/ClientConnection.cpp index bd805c02f9..eaaf007bbb 100644 --- a/Userland/Services/WindowServer/ClientConnection.cpp +++ b/Userland/Services/WindowServer/ClientConnection.cpp @@ -722,7 +722,7 @@ void ClientConnection::handle(const Messages::WindowServer::WM_SetWindowMinimize OwnPtr ClientConnection::handle(const Messages::WindowServer::Greet&) { - return make(client_id(), Screen::the().rect(), Gfx::current_system_theme_buffer()); + return make(Screen::the().rect(), Gfx::current_system_theme_buffer()); } void ClientConnection::handle(const Messages::WindowServer::WM_SetWindowTaskbarRect& message) diff --git a/Userland/Services/WindowServer/WindowServer.ipc b/Userland/Services/WindowServer/WindowServer.ipc index a9dec18bdf..b4473ba15d 100644 --- a/Userland/Services/WindowServer/WindowServer.ipc +++ b/Userland/Services/WindowServer/WindowServer.ipc @@ -1,6 +1,6 @@ endpoint WindowServer = 2 { - Greet() => (i32 client_id, Gfx::IntRect screen_rect, Core::AnonymousBuffer theme_buffer) + Greet() => (Gfx::IntRect screen_rect, Core::AnonymousBuffer theme_buffer) CreateMenubar() => (i32 menubar_id) DestroyMenubar(i32 menubar_id) => ()