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:
parent
d64e6abe08
commit
27db7ed11f
Notes:
github-actions[bot]
2025-04-29 15:52:34 +00:00
Author: https://github.com/ADKaster
Commit: 27db7ed11f
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4516
Reviewed-by: https://github.com/kalenikaliaksandr ✅
1 changed files with 7 additions and 0 deletions
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue