mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-01 23:26:36 +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: 74829cdb75
1 changed files with 5 additions and 0 deletions
|
@ -98,6 +98,11 @@ public:
|
||||||
|
|
||||||
void post_message(const IMessage& message)
|
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();
|
auto buffer = message.encode();
|
||||||
|
|
||||||
int nwritten = write(m_socket->fd(), buffer.data(), (size_t)buffer.size());
|
int nwritten = write(m_socket->fd(), buffer.data(), (size_t)buffer.size());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue