LibIPC: Protect underlying socket of TransportSocket with RWLock

This is necessary to prevent the socket from being closed while it is
being used for reading or writing.
This commit is contained in:
Aliaksandr Kalenik 2025-04-10 22:05:11 +02:00 committed by Alexander Kalenik
commit 681333d329
Notes: github-actions[bot] 2025-04-10 21:41:11 +00:00
2 changed files with 11 additions and 0 deletions

View file

@ -12,6 +12,7 @@
#include <LibIPC/UnprocessedFileDescriptors.h>
#include <LibThreading/ConditionVariable.h>
#include <LibThreading/MutexProtected.h>
#include <LibThreading/RWLock.h>
#include <LibThreading/Thread.h>
namespace IPC {
@ -104,6 +105,7 @@ private:
static ErrorOr<void> send_message(Core::LocalSocket&, ReadonlyBytes& bytes, Vector<int>& unowned_fds);
NonnullOwnPtr<Core::LocalSocket> m_socket;
mutable Threading::RWLock m_socket_rw_lock;
ByteBuffer m_unprocessed_bytes;
UnprocessedFileDescriptors m_unprocessed_fds;