Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions ios/TcpSocketClient.m
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ @interface TcpSocketClient () {
long _sendTag;
SecTrustRef _peerTrust;
SecIdentityRef _clientIdentity;
NSDictionary *_tlsOptionsPending;
}

- (id)initWithClientId:(NSNumber *)clientID
Expand Down Expand Up @@ -163,7 +164,7 @@ - (BOOL)connect:(NSString *)host
error:error];
}
if (result && tlsOptions) {
[self startTLS:tlsOptions];
_tlsOptionsPending = [tlsOptions copy]; // Save for later
}
return result;
}
Expand Down Expand Up @@ -571,9 +572,15 @@ - (void)socket:(GCDAsyncSocket *)sock
return;
}

// Show up if SSL handsake is done
// Show up if SSL handshake is done
if (!_tls) {
[_clientDelegate onConnect:self];
if (_tlsOptionsPending) {
[self startTLS:_tlsOptionsPending];
_tlsOptionsPending = nil;
} else {
[_clientDelegate onConnect:self];
_connecting = false;
}
}
[sock readDataWithTimeout:-1 tag:_id.longValue];
}
Expand Down