SIGN IN SIGN UP
facebook / react-native UNCLAIMED

A framework for building native applications using React

0 0 0 C++

Fix thread-safety race in InspectorNetworkHelper (#55579)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/55579

InspectorNetworkHelper used a lateinit var with an isInitialized check to lazily create an OkHttpClient. This pattern is not thread-safe — concurrent calls to loadNetworkResource could race on the initialization. Replace with the shared DevSupportHttpClient.websocketClient singleton, which is initialized at class load time and is inherently safe.

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D93480252

fbshipit-source-id: fefb144b3b26670954a77aa27c9b7f637290f21b
N
Nicola Corti committed
101b332dc40db304a2ffcc703d471052be2f6255
Parent: 6f5f2a5