mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 00:37:45 +00:00
LibIPC: Make IPC::Connection::post_message() return ErrorOr
This commit is contained in:
parent
982ac34437
commit
8d76eb773f
4 changed files with 30 additions and 23 deletions
|
@ -33,7 +33,7 @@ public:
|
|||
virtual ~ConnectionBase() override;
|
||||
|
||||
bool is_open() const { return m_socket->is_open(); }
|
||||
void post_message(Message const&);
|
||||
ErrorOr<void> post_message(Message const&);
|
||||
|
||||
void shutdown();
|
||||
virtual void die() { }
|
||||
|
@ -52,7 +52,7 @@ protected:
|
|||
ErrorOr<Vector<u8>> read_as_much_as_possible_from_socket_without_blocking();
|
||||
ErrorOr<void> drain_messages_from_peer();
|
||||
|
||||
void post_message(MessageBuffer);
|
||||
ErrorOr<void> post_message(MessageBuffer);
|
||||
void handle_messages();
|
||||
|
||||
IPC::Stub& m_local_stub;
|
||||
|
@ -90,7 +90,7 @@ public:
|
|||
template<typename RequestType, typename... Args>
|
||||
NonnullOwnPtr<typename RequestType::ResponseType> send_sync(Args&&... args)
|
||||
{
|
||||
post_message(RequestType(forward<Args>(args)...));
|
||||
MUST(post_message(RequestType(forward<Args>(args)...)));
|
||||
auto response = wait_for_specific_endpoint_message<typename RequestType::ResponseType, PeerEndpoint>();
|
||||
VERIFY(response);
|
||||
return response.release_nonnull();
|
||||
|
@ -99,7 +99,8 @@ public:
|
|||
template<typename RequestType, typename... Args>
|
||||
OwnPtr<typename RequestType::ResponseType> send_sync_but_allow_failure(Args&&... args)
|
||||
{
|
||||
post_message(RequestType(forward<Args>(args)...));
|
||||
if (post_message(RequestType(forward<Args>(args)...)).is_error())
|
||||
return nullptr;
|
||||
return wait_for_specific_endpoint_message<typename RequestType::ResponseType, PeerEndpoint>();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue