diff options
author | Gunnar Beutner <gbeutner@serenityos.org> | 2021-05-03 13:33:59 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-05-03 21:14:40 +0200 |
commit | 5bb79ea0a79322d944368825ec617ccfb8912b81 (patch) | |
tree | 120c86845f8285f398000386722d0a7cda312440 /Userland/Libraries/LibProtocol/RequestClient.cpp | |
parent | 78803ce384d62c40958cc8191a036307f5d8bc9f (diff) | |
download | serenity-5bb79ea0a79322d944368825ec617ccfb8912b81.zip |
Userland: Update IPC calls to use proxies
This updates all existing code to use the auto-generated client
methods instead of post_message/send_sync.
Diffstat (limited to 'Userland/Libraries/LibProtocol/RequestClient.cpp')
-rw-r--r-- | Userland/Libraries/LibProtocol/RequestClient.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/Userland/Libraries/LibProtocol/RequestClient.cpp b/Userland/Libraries/LibProtocol/RequestClient.cpp index 0fb195c243..8c25c1ea27 100644 --- a/Userland/Libraries/LibProtocol/RequestClient.cpp +++ b/Userland/Libraries/LibProtocol/RequestClient.cpp @@ -18,12 +18,12 @@ RequestClient::RequestClient() void RequestClient::handshake() { - send_sync<Messages::RequestServer::Greet>(); + greet(); } bool RequestClient::is_supported_protocol(const String& protocol) { - return send_sync<Messages::RequestServer::IsSupportedProtocol>(protocol)->supported(); + return IPCProxy::is_supported_protocol(protocol).supported(); } template<typename RequestHashMapTraits> @@ -33,29 +33,30 @@ RefPtr<Request> RequestClient::start_request(const String& method, const String& for (auto& it : request_headers) header_dictionary.add(it.key, it.value); - auto response = send_sync<Messages::RequestServer::StartRequest>(method, url, header_dictionary, ByteBuffer::copy(request_body)); - auto request_id = response->request_id(); - if (request_id < 0 || !response->response_fd().has_value()) + auto response = IPCProxy::start_request(method, url, header_dictionary, ByteBuffer::copy(request_body)); + auto request_id = response.request_id(); + if (request_id < 0 || !response.response_fd().has_value()) return nullptr; - auto response_fd = response->response_fd().value().take_fd(); + auto response_fd = response.response_fd().value().take_fd(); auto request = Request::create_from_id({}, *this, request_id); request->set_request_fd({}, response_fd); m_requests.set(request_id, request); return request; + return nullptr; } bool RequestClient::stop_request(Badge<Request>, Request& request) { if (!m_requests.contains(request.id())) return false; - return send_sync<Messages::RequestServer::StopRequest>(request.id())->success(); + return IPCProxy::stop_request(request.id()).success(); } bool RequestClient::set_certificate(Badge<Request>, Request& request, String certificate, String key) { if (!m_requests.contains(request.id())) return false; - return send_sync<Messages::RequestServer::SetCertificate>(request.id(), move(certificate), move(key))->success(); + return IPCProxy::set_certificate(request.id(), move(certificate), move(key)).success(); } void RequestClient::request_finished(i32 request_id, bool success, u32 total_size) |