LibIPC: Increase the local socket buffer size to 128 KiB if possible

This makes a big difference on macOS, where the default buffer size
for local sockets is 8 KiB. With bigger buffers, we don't have to
block on IPC nearly as often.
This commit is contained in:
Andreas Kling 2024-09-15 15:41:29 +02:00 committed by Andreas Kling
parent 4bc5d6a681
commit f0fc516cf2
Notes: github-actions[bot] 2024-09-19 05:38:50 +00:00

View file

@ -19,6 +19,10 @@ ConnectionBase::ConnectionBase(IPC::Stub& local_stub, NonnullOwnPtr<Core::LocalS
, m_socket(move(socket))
, m_local_endpoint_magic(local_endpoint_magic)
{
socklen_t socket_buffer_size = 128 * KiB;
(void)Core::System::setsockopt(m_socket->fd().value(), SOL_SOCKET, SO_SNDBUF, &socket_buffer_size, sizeof(socket_buffer_size));
(void)Core::System::setsockopt(m_socket->fd().value(), SOL_SOCKET, SO_RCVBUF, &socket_buffer_size, sizeof(socket_buffer_size));
m_responsiveness_timer = Core::Timer::create_single_shot(3000, [this] { may_have_become_unresponsive(); });
m_socket->on_ready_to_read = [this] {
NonnullRefPtr protect = *this;