attempt to handle tls handshake failure properly

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@37274 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2013-10-25 09:34:35 +00:00
parent cd76262056
commit f769807665
3 changed files with 59 additions and 13 deletions

View file

@ -504,7 +504,30 @@ static NSArray *keys = nil;
if ([session handshake] == YES)
{
handshake = NO; // Handshake is now complete.
active = [session active]; // The TLS session is now active.
active = [session active]; // Is the TLS session now active?
if (NO == active)
{
NSString *problem = [session problem];
NSError *theError;
if (nil == problem)
{
problem = @"TLS handshake failure";
}
theError = [NSError errorWithDomain: NSCocoaErrorDomain
code: 0
userInfo: [NSDictionary dictionaryWithObject: problem
forKey: NSLocalizedDescriptionKey]];
if ([istream streamStatus] != NSStreamStatusError)
{
[istream _recordError: theError];
}
if ([ostream streamStatus] != NSStreamStatusError)
{
[ostream _recordError: theError];
}
[self bye];
}
}
}
}