mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-04 05:20:30 +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
Notes:
sideshowbarker
2024-07-19 09:50:37 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/74829cdb753
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…
Reference in a new issue