react-native-macos/Libraries
Lukas Weber 0d4b0e9417 Fixes RCTReconnectingWebSocket connecting in infinite loop when stopped before it connects (#26864)
Summary:
When `[RCTReconnectingWebSocket stop]` is called and `[RCTReconnectingWebSocket  reconnect]` is scheduled afterwards (i.e. connection didn't happen before `[RCTReconnectingWebSocket stop]` being invoked), it will keep reconnecting forever.

Also fixes retain loop in block within `[RCTReconnectingWebSocket  reconnect]`. When RCTReconnectingWebSocket is stopped and reference to it set to nil, block in reconnect will still keep self alive and reconnecting forever.

I found this edge case when I tried to stop RCTPackagerConnection after some time, so it doesn't spam with `[] nw_socket_handle_socket_event [C34585.1:1] Socket SO_ERROR [61: Connection refused]` when we don' have Metro running (we have brownfield app, so iOS devs don't need Metro running most of the time).

## Changelog
[iOS] [Fixed] -  RCTReconnectingWebSocket is reconnecting infinitely when stopped before getting connected
Pull Request resolved: https://github.com/facebook/react-native/pull/26864

Test Plan:
- Put breakpoint into `[RCTReconnectingWebSocket  reconnect]`
- Start sample RN app **without having Metro running**
- Into AppDelegate add something like
```objc
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
   [RCTPackagerConnection.sharedPackagerConnection stop]
});
```
- After the previous block is dispatched reconnect should not be invoked anymore

Reviewed By: motiz88

Differential Revision: D19767742

Pulled By: rickhanlonii

fbshipit-source-id: dabb2369b06217b961e9d2611257c106d350f70c
2020-02-11 10:54:39 -08:00
..
ART iOS: Deprecate iOS 9 / tvOS 9 SDK support 2020-01-02 12:52:12 -08:00
ActionSheetIOS iOS: Deprecate iOS 9 / tvOS 9 SDK support 2020-01-02 12:52:12 -08:00
Alert Remove deprecated support for Alert.prompt with type as Callback 2020-02-06 02:02:31 -08:00
Animated Make JS Animated Driver use forceUpdate in Fabric for list components 2020-02-05 18:38:28 -08:00
AppState TM JS: Revert to import from TurboModuleRegistry.js 2019-11-08 11:44:16 -08:00
BatchedBridge Stub out callFunctionReturnResultAndFlushedQueue 2020-02-06 03:35:32 -08:00
Blob Transform empty responses into empty Blobs 2020-01-27 10:27:14 -08:00
BugReporting Convert easy files to flow strict-local 2019-12-05 16:06:46 -08:00
CameraRoll iOS: guard image picker logic to check for the right source type 2019-12-20 01:41:02 -08:00
Components Add innerViewRef prop to ScrollView 2020-02-11 10:39:24 -08:00
Core Backwards-compatible implementation for registerCallableModule 2019-12-17 18:38:57 -08:00
DeprecatedPropTypes Convert easy files to flow strict-local 2019-12-05 16:06:46 -08:00
EventEmitter Exact-by-default codemod for react-native-github 2019-11-21 09:42:57 -08:00
Experimental Remove IncrementalPresenter 2019-12-07 10:41:54 -08:00
FBLazyVector Rename isolation root to "default" in fbobjc 2020-01-24 08:26:36 -08:00
FBReactNativeSpec Rename isolation root to "default" in fbobjc 2020-01-24 08:26:36 -08:00
HeapCapture Fix NativeJSCHeapCapture 2020-01-14 08:03:49 -08:00
Image Fix resolving assets outside of the project root (#27932) 2020-02-03 03:15:56 -08:00
Inspector Convert Inspector to call ref.measure 2019-12-17 20:09:25 -08:00
Interaction Convert easy files to flow strict-local 2019-12-05 16:06:46 -08:00
JSInspector Exact-by-default codemod for react-native-github 2019-11-21 09:42:57 -08:00
LayoutAnimation Export LayoutAnimationConfig type 2020-01-28 17:10:30 -08:00
Linking Convert easy files to flow strict-local 2019-12-05 16:06:46 -08:00
LinkingIOS Upgrade Folly to v2020.01.13.00 (#27810) 2020-01-21 12:44:00 -08:00
Lists Fix indentation of inline snapshots in tests 2020-02-03 03:19:10 -08:00
LogBox LogBox - Add build version and open in browser 2020-01-29 06:23:26 -08:00
Modal Revert D19235758: Implement onRequestClose for iOS 13+ modals 2020-02-06 14:45:42 -08:00
NativeAnimation Upgrade Folly to v2020.01.13.00 (#27810) 2020-01-21 12:44:00 -08:00
NativeModules/specs Add missing NativeEventListener methods to NativeDevSettings (#27838) 2020-01-23 13:20:53 -08:00
Network Transform empty responses into empty Blobs 2020-01-27 10:27:14 -08:00
NewAppScreen Convert easy files to flow strict-local 2019-12-05 16:06:46 -08:00
Performance Convert easy files to flow strict-local 2019-12-05 16:06:46 -08:00
PermissionsAndroid Convert easy files to flow strict-local 2019-12-05 16:06:46 -08:00
Pressability Pressability: Support Rect or Numeric Size 2020-01-28 15:14:23 -08:00
PushNotificationIOS Resolve and reject promise for PushNotificationIOS.requestPermissions 2020-02-07 08:50:26 -08:00
RCTRequired Rename isolation root to "default" in fbobjc 2020-01-24 08:26:36 -08:00
ReactNative Remove method findShadowNodeByTag_DEPRECATED from UIManagerBinding class 2019-12-23 17:09:44 -08:00
ReactPrivate Add annotations to ReactNativePrivateInterface 2019-08-22 17:50:36 -07:00
Renderer React Native sync for revisions 6cff70a...19f6fe1 2020-01-09 11:18:06 -08:00
Settings Upgrade Folly to v2020.01.13.00 (#27810) 2020-01-21 12:44:00 -08:00
Share Share - title is not a valid attribute in iOS (#27351) 2019-12-04 15:49:22 -08:00
Storage Convert easy files to flow strict-local 2019-12-05 16:06:46 -08:00
StyleSheet Pressability: Support Rect or Numeric Size 2020-01-28 15:14:23 -08:00
SurfaceBackedComponent Tidy up license headers [2/n] 2019-10-16 10:06:34 -07:00
SurfaceHostingComponent Tidy up license headers [2/n] 2019-10-16 10:06:34 -07:00
Text Implement setTextAndSelection as view command in TextInput 2020-02-07 14:10:28 -08:00
TurboModule Clear some lint warnings (#27893) 2020-01-29 04:36:28 -08:00
TypeSafety Upgrade Folly to v2020.01.13.00 (#27810) 2020-01-21 12:44:00 -08:00
Types Convert easy files to flow strict-local 2019-12-05 16:06:46 -08:00
Utilities Add hybrid scene tracker 2020-02-03 18:46:38 -08:00
Vibration Upgrade Folly to v2020.01.13.00 (#27810) 2020-01-21 12:44:00 -08:00
WebSocket Fixes RCTReconnectingWebSocket connecting in infinite loop when stopped before it connects (#26864) 2020-02-11 10:54:39 -08:00
Wrapper Tidy up license headers [3/n] 2019-10-16 10:06:34 -07:00
YellowBox LogBox fixes for OSS 2019-12-18 19:28:56 -08:00
__flowtests__ Manually fix places the codemod doesnt hit 2019-11-19 13:38:18 -08:00
polyfills Remove groupCollapsed from list of unsupported polyfills 2019-12-06 13:35:47 -08:00
vendor RN: Delete `merge[Into]` 2019-10-12 15:52:27 -07:00
.npmignore npmignore: ignore tests and fixtures 2018-02-27 08:42:14 -08:00
Promise.js Don't crash when pretty-format is not available 2019-11-19 16:22:29 -08:00
UTFSequence.js Clean-up $TEMPORARY$object in xplat/js/react-native-github 2019-08-21 09:58:24 -07:00
promiseRejectionIsError.js Migrate "Libraries" from Haste to standard path-based requires (sans vendor & renderers) (#24749) 2019-05-08 08:48:59 -07:00