mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-26 18:21:04 +00:00
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:
parent
46394796f2
commit
c92d6b22be
1 changed files with 13 additions and 7 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue