mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 21:47:45 +00: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
1 changed files with 5 additions and 0 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue