mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-08 16:12:23 +02:00
Previously, the bootstrap handshake used a two-state machine (WaitingForPorts / WaitingForReplyPort) to handle a race: the parent registering transport ports and the child sending a bootstrap request could arrive in either order, so whichever came first stored its half and the second completed the handshake. Eliminate the race by holding a mutex across spawn() and register_child_transport(). Since the child cannot send a bootstrap request before it exists, and the lock isn't released until its transport is registered, handle_bootstrap_request() is guaranteed to find the entry. This reduces the pending map to a simple pid-to-ports lookup and collapses the two-variant state into two straightforward branches: known child, or on-demand (non-child) caller like WebDriver.
7.9 KiB
7.9 KiB