mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
e55ea2daf1
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/45035 Changelog: [General][Fixed] Avoid a zombie state when opening a second debugger frontend concurrently. The problem here was that we were sending proxy-protocol messages to the device in the wrong order (`disconnect` *after* `connect`): {F1701266597} The root cause was that we were depending on the outgoing debugger socket's async `close` event to trigger sending the `disconnect` message to the device. This would happen after we'd already (synchronously) sent the `connect` message. With this diff, we send the `disconnect` message synchronously with calling `close()` on the debugger socket, which fixes the ordering problem at the source. To avoid sending duplicate `disconnect` messages (e.g. one before calling `close()` and one from the `close` event handler), we store some extra state on `Device` (`#connectedPageIds`). Reviewed By: robhogan, huntie Differential Revision: D58730634 fbshipit-source-id: 0f54af2e4f8071a8f6d97cc9e3d8a4ea89a46f43