diff --git a/ios/TcpSocketClient.m b/ios/TcpSocketClient.m index ad52d6c..499bbf4 100644 --- a/ios/TcpSocketClient.m +++ b/ios/TcpSocketClient.m @@ -66,6 +66,7 @@ @interface TcpSocketClient () { long _sendTag; SecTrustRef _peerTrust; SecIdentityRef _clientIdentity; + NSDictionary *_tlsOptionsPending; } - (id)initWithClientId:(NSNumber *)clientID @@ -163,7 +164,7 @@ - (BOOL)connect:(NSString *)host error:error]; } if (result && tlsOptions) { - [self startTLS:tlsOptions]; + _tlsOptionsPending = [tlsOptions copy]; // Save for later } return result; } @@ -573,7 +574,12 @@ - (void)socket:(GCDAsyncSocket *)sock // Show up if SSL handsake is done if (!_tls) { - [_clientDelegate onConnect:self]; + if (_tlsOptionsPending) { + [self startTLS:_tlsOptionsPending]; + _tlsOptionsPending = nil; + } else { + [_clientDelegate onConnect:self]; + } } [sock readDataWithTimeout:-1 tag:_id.longValue]; } diff --git a/package.json b/package.json index b02555a..1d731a2 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { - "name": "react-native-tcp-socket", + "name": "@iostls/react-native-tcp-socket", "title": "React Native Tcp Socket", - "version": "6.3.0", - "description": "React Native TCP socket API for Android & iOS with SSL/TLS support", + "version": "6.3.0-iostls.0", + "description": "React Native TCP socket API for Android & iOS with SSL/TLS support.TLS-fixed fork of react-native-tcp-socket with iOS mutual auth support", "main": "src/index.js", "types": "lib/types/index.d.ts", "scripts": { @@ -26,7 +26,7 @@ ], "repository": { "type": "git", - "url": "git+https://github.com/Rapsssito/react-native-tcp-socket.git", + "url": "https://github.com/manoaxcend/react-native-tcp-socket", "baseUrl": "https://github.com/Rapsssito/react-native-tcp-socket" }, "keywords": [