summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibProtocol
diff options
context:
space:
mode:
authorGunnar Beutner <gbeutner@serenityos.org>2021-05-03 13:55:29 +0200
committerAndreas Kling <kling@serenityos.org>2021-05-03 21:14:40 +0200
commiteb21aa65d131f6fb382ad80d672e5a7ffb1a21e1 (patch)
tree674d52f397d8318941e97426b5100c18c8ac885f /Userland/Libraries/LibProtocol
parent5bb79ea0a79322d944368825ec617ccfb8912b81 (diff)
downloadserenity-eb21aa65d131f6fb382ad80d672e5a7ffb1a21e1.zip
Userland: Make IPC results with one return value available directly
This changes client methods so that they return the IPC response's return value directly - instead of the response struct - for IPC methods which only have a single return value.
Diffstat (limited to 'Userland/Libraries/LibProtocol')
-rw-r--r--Userland/Libraries/LibProtocol/RequestClient.cpp9
-rw-r--r--Userland/Libraries/LibProtocol/RequestClient.h1
-rw-r--r--Userland/Libraries/LibProtocol/WebSocketClient.cpp7
3 files changed, 5 insertions, 12 deletions
diff --git a/Userland/Libraries/LibProtocol/RequestClient.cpp b/Userland/Libraries/LibProtocol/RequestClient.cpp
index 8c25c1ea27..cbf3d6cc36 100644
--- a/Userland/Libraries/LibProtocol/RequestClient.cpp
+++ b/Userland/Libraries/LibProtocol/RequestClient.cpp
@@ -21,11 +21,6 @@ void RequestClient::handshake()
greet();
}
-bool RequestClient::is_supported_protocol(const String& protocol)
-{
- return IPCProxy::is_supported_protocol(protocol).supported();
-}
-
template<typename RequestHashMapTraits>
RefPtr<Request> RequestClient::start_request(const String& method, const String& url, const HashMap<String, String, RequestHashMapTraits>& request_headers, ReadonlyBytes request_body)
{
@@ -49,14 +44,14 @@ bool RequestClient::stop_request(Badge<Request>, Request& request)
{
if (!m_requests.contains(request.id()))
return false;
- return IPCProxy::stop_request(request.id()).success();
+ return IPCProxy::stop_request(request.id());
}
bool RequestClient::set_certificate(Badge<Request>, Request& request, String certificate, String key)
{
if (!m_requests.contains(request.id()))
return false;
- return IPCProxy::set_certificate(request.id(), move(certificate), move(key)).success();
+ return IPCProxy::set_certificate(request.id(), move(certificate), move(key));
}
void RequestClient::request_finished(i32 request_id, bool success, u32 total_size)
diff --git a/Userland/Libraries/LibProtocol/RequestClient.h b/Userland/Libraries/LibProtocol/RequestClient.h
index 1dfe45bf7f..a07a5d0f6b 100644
--- a/Userland/Libraries/LibProtocol/RequestClient.h
+++ b/Userland/Libraries/LibProtocol/RequestClient.h
@@ -23,7 +23,6 @@ class RequestClient
public:
virtual void handshake() override;
- bool is_supported_protocol(const String&);
template<typename RequestHashMapTraits = Traits<String>>
RefPtr<Request> start_request(const String& method, const String& url, const HashMap<String, String, RequestHashMapTraits>& request_headers = {}, ReadonlyBytes request_body = {});
diff --git a/Userland/Libraries/LibProtocol/WebSocketClient.cpp b/Userland/Libraries/LibProtocol/WebSocketClient.cpp
index e8607d7e2b..4b07f2198d 100644
--- a/Userland/Libraries/LibProtocol/WebSocketClient.cpp
+++ b/Userland/Libraries/LibProtocol/WebSocketClient.cpp
@@ -25,8 +25,7 @@ RefPtr<WebSocket> WebSocketClient::connect(const URL& url, const String& origin,
IPC::Dictionary header_dictionary;
for (auto& it : request_headers)
header_dictionary.add(it.key, it.value);
- auto response = IPCProxy::connect(url, origin, protocols, extensions, header_dictionary);
- auto connection_id = response.connection_id();
+ auto connection_id = IPCProxy::connect(url, origin, protocols, extensions, header_dictionary);
if (connection_id < 0)
return nullptr;
auto connection = WebSocket::create_from_id({}, *this, connection_id);
@@ -38,7 +37,7 @@ u32 WebSocketClient::ready_state(Badge<WebSocket>, WebSocket& connection)
{
if (!m_connections.contains(connection.id()))
return (u32)WebSocket::ReadyState::Closed;
- return IPCProxy::ready_state(connection.id()).ready_state();
+ return IPCProxy::ready_state(connection.id());
}
void WebSocketClient::send(Badge<WebSocket>, WebSocket& connection, ByteBuffer data, bool is_text)
@@ -59,7 +58,7 @@ bool WebSocketClient::set_certificate(Badge<WebSocket>, WebSocket& connection, S
{
if (!m_connections.contains(connection.id()))
return false;
- return IPCProxy::set_certificate(connection.id(), move(certificate), move(key)).success();
+ return IPCProxy::set_certificate(connection.id(), move(certificate), move(key));
}
void WebSocketClient::connected(i32 connection_id)