mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-25 17:25:08 +02:00
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:
committed by
Alexander Kalenik
parent
e7a625185a
commit
19627bba54
Notes:
github-actions[bot]
2026-03-14 17:26:15 +00:00
Author: https://github.com/kalenikaliaksandr Commit: https://github.com/LadybirdBrowser/ladybird/commit/19627bba541 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/8416
@@ -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)));
|
||||
|
||||
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user