mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-10 13:00:29 +03:00
LibIPC: Short-cirtcuit post_message() if socket already disconnected
To allow for more asynchronous teardown of IClientConnection, make the post_message() function simply return if called after the IPC socket has been closed.
This commit is contained in:
parent
e576c9e952
commit
74829cdb75
Notes:
sideshowbarker
2024-07-19 09:50:37 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/74829cdb753
@ -98,6 +98,11 @@ public:
|
||||
|
||||
void post_message(const IMessage& message)
|
||||
{
|
||||
// NOTE: If this connection is being shut down, but has not yet been destroyed,
|
||||
// the socket will be closed. Don't try to send more messages.
|
||||
if (!m_socket->is_open())
|
||||
return;
|
||||
|
||||
auto buffer = message.encode();
|
||||
|
||||
int nwritten = write(m_socket->fd(), buffer.data(), (size_t)buffer.size());
|
||||
|
Loading…
Reference in New Issue
Block a user