From fd784ddb154158ad44a433ccc2f5ec8edc41392a Mon Sep 17 00:00:00 2001 From: Aliaksandr Kalenik Date: Thu, 10 Apr 2025 14:52:37 +0200 Subject: [PATCH] LibIPC: Check "unsent bytes" pointer while deciding whether to return ...unsent data back in the queue. This change should not fix any bugs, but allows to avoid unnecessary `return_unsent_data_to_front_of_queue()` calls. --- Libraries/LibIPC/TransportSocket.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Libraries/LibIPC/TransportSocket.cpp b/Libraries/LibIPC/TransportSocket.cpp index 5800e165333..db2f39dcea9 100644 --- a/Libraries/LibIPC/TransportSocket.cpp +++ b/Libraries/LibIPC/TransportSocket.cpp @@ -63,16 +63,16 @@ TransportSocket::TransportSocket(NonnullOwnPtr socket) break; auto [bytes, fds] = send_queue->dequeue(4096); - ReadonlyBytes bytes_to_send = bytes; + ReadonlyBytes remaining_to_send_bytes = bytes; - auto result = send_message(*m_socket, bytes_to_send, fds); + auto result = send_message(*m_socket, remaining_to_send_bytes, fds); if (result.is_error()) { dbgln("TransportSocket::send_thread: {}", result.error()); VERIFY_NOT_REACHED(); } - if (!bytes.is_empty() || !fds.is_empty()) { - send_queue->return_unsent_data_to_front_of_queue(bytes_to_send, fds); + if (!remaining_to_send_bytes.is_empty() || !fds.is_empty()) { + send_queue->return_unsent_data_to_front_of_queue(remaining_to_send_bytes, fds); } {