LibIPC: Return TransportHandle directly from create_paired()

Previously, `create_paired()` returned two full Transport objects, and
callers would immediately call `from_transport()` on the remote side to
extract its underlying fd. This wasted resources: the remote
Transport's IO thread, wakeup pipes, and send queue were initialized
only to be torn down without ever sending or receiving a message.

Now `create_paired()` returns `{Transport, TransportHandle}` — the
remote side is born as a lightweight handle containing just the raw fd,
skipping all unnecessary initialization.

Also replace `release_underlying_transport_for_transfer()` (which
returned a raw int fd) with `release_for_transfer()` (which returns a
TransportHandle directly), hiding the socket implementation detail
from callers including MessagePort.
This commit is contained in:
Aliaksandr Kalenik
2026-03-14 17:34:46 +01:00
committed by Alexander Kalenik
parent e7a625185a
commit 19627bba54
Notes: github-actions[bot] 2026-03-14 17:26:15 +00:00
11 changed files with 33 additions and 42 deletions

View File

@@ -58,7 +58,7 @@ Messages::ImageDecoderServer::InitTransportResponse ConnectionFromClient::init_t
ErrorOr<IPC::TransportHandle> ConnectionFromClient::connect_new_client()
{
auto paired = TRY(IPC::Transport::create_paired());
auto handle = TRY(IPC::TransportHandle::from_transport(*paired.remote));
auto handle = move(paired.remote_handle);
// Note: A ref is stored in the static s_connections map
auto client = adopt_ref(*new ConnectionFromClient(move(paired.local)));

View File

@@ -141,7 +141,7 @@ Messages::RequestServer::ConnectNewClientsResponse ConnectionFromClient::connect
ErrorOr<IPC::TransportHandle> ConnectionFromClient::create_client_socket()
{
auto paired = TRY(IPC::Transport::create_paired());
auto handle = TRY(IPC::TransportHandle::from_transport(*paired.remote));
auto handle = move(paired.remote_handle);
// Note: A ref is stored in the m_connections map
auto client = adopt_ref(*new ConnectionFromClient(move(paired.local), IsPrimaryConnection::No, m_connections, m_disk_cache));