avoid unnecessary reset of descriptor during connect/accept

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@35590 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2012-09-22 05:55:09 +00:00
parent d2d16ceace
commit f2a4d14b82

View file

@ -401,7 +401,7 @@ static NSString *cipherList = nil;
/*
* Ensure we have a context and handle to connect with.
*/
if (ctx == 0)
if (0 == ctx)
{
ctx = SSL_CTX_new(SSLv23_client_method());
if (permitSSLv2 == NO)
@ -413,16 +413,22 @@ static NSString *cipherList = nil;
SSL_CTX_set_cipher_list(ctx, [cipherList UTF8String]);
}
}
if (ssl == 0)
if (0 == ssl)
{
ssl = SSL_new(ctx);
}
/*
* Set non-blocking so accept won't hang if remote end goes wrong.
*/
[self setNonBlocking: YES];
ret = SSL_set_fd(ssl, descriptor);
if (SSL_get_fd(ssl) == descriptor)
{
ret = 1;
}
else
{
/* Set non-blocking so accept won't hang if remote end goes wrong.
*/
[self setNonBlocking: YES];
ret = SSL_set_fd(ssl, descriptor);
}
if (1 == ret)
{
if (YES == isOutgoing)