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:
rfm 2012-09-22 05:55:09 +00:00
parent 46394796f2
commit c92d6b22be

View file

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