1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-09 09:34:57 +09:00

LibIPC: Guard better against closure in the TransportSocket send thread

And crash less when the socket is closed while there are still messages
in the queue.
This commit is contained in:
Andrew Kaster 2025-04-28 17:56:09 -06:00 committed by Andrew Kaster
parent d64e6abe08
commit 27db7ed11f
Notes: github-actions[bot] 2025-04-29 15:52:34 +00:00

View file

@ -68,8 +68,15 @@ TransportSocket::TransportSocket(NonnullOwnPtr<Core::LocalSocket> socket)
ReadonlyBytes remaining_to_send_bytes = bytes;
Threading::RWLockLocker<Threading::LockMode::Read> lock(m_socket_rw_lock);
if (!m_socket->is_open())
break;
auto result = send_message(*m_socket, remaining_to_send_bytes, fds);
if (result.is_error()) {
if (result.error().is_errno() && result.error().code() == EPIPE) {
// The socket is closed, we can stop sending.
VERIFY(!m_socket->is_open());
break;
}
dbgln("TransportSocket::send_thread: {}", result.error());
VERIFY_NOT_REACHED();
}