LibIPC+Meta: Keep message buffer alive until acknowledged by peer

This change ensures that instead of immediately deallocating the message
buffer after sending, we retain it in an acknowledgement wait queue
until an acknowledgement is received from the peer. This is necessary
to handle a behavior of the macOS kernel, which may prematurely
garbage-collect file descriptors contained within the message buffer
before the peer receives them.

The acknowledgement mechanism assumes messages are received in the same
order they were sent so, each acknowledgement message simply indicates
the count of successfully received messages, specifying how many entries
can safely be removed from the acknowledgement wait queue.
This commit is contained in:
Aliaksandr Kalenik 2025-04-05 00:05:20 +02:00 committed by Andreas Kling
commit c3121c9d8a
Notes: github-actions[bot] 2025-04-05 21:15:26 +00:00
5 changed files with 121 additions and 16 deletions

View file

@ -760,6 +760,8 @@ public:
generator.append(R"~~~(
case (int)IPC::LargeMessageWrapper::MESSAGE_ID:
return TRY(IPC::LargeMessageWrapper::decode(message_endpoint_magic, stream, files));
case (int)IPC::Acknowledgement::MESSAGE_ID:
return TRY(IPC::Acknowledgement::decode(message_endpoint_magic, stream, files));
)~~~");
generator.append(R"~~~(