Improve detection/logging of connection attempt failures

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@24170 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2006-11-30 09:00:44 +00:00
parent 4e6a7e777c
commit 08ee139d3f
2 changed files with 13 additions and 4 deletions

View file

@ -902,12 +902,17 @@ static Class runLoopClass;
int res = 0;
unsigned len = sizeof(res);
if (getsockopt(desc, SOL_SOCKET, SO_ERROR, (char*)&res, &len) == 0
&& res != 0)
if (getsockopt(desc, SOL_SOCKET, SO_ERROR, (char*)&res, &len) != 0)
{
state = GS_H_UNCON;
NSLog(@"connect attempt failed - %@", [NSError _last]);
}
else if (res != 0)
{
state = GS_H_UNCON;
NSLog(@"connect attempt failed - %@",
[NSError _systemError: res]);
}
else
{
NSData *d = newDataWithEncodedPort([self recvPort]);

View file

@ -1104,12 +1104,16 @@ static Class runLoopClass;
int res = 0;
unsigned len = sizeof(res);
if (getsockopt(desc, SOL_SOCKET, SO_ERROR, (char*)&res, &len) == 0
&& res != 0)
if (getsockopt(desc, SOL_SOCKET, SO_ERROR, (char*)&res, &len) != 0)
{
state = GS_H_UNCON;
NSLog(@"connect attempt failed - %@", [NSError _last]);
}
else if (res != 0)
{
state = GS_H_UNCON;
NSLog(@"connect attempt failed - %@", [NSError _systemError: res]);
}
else
{
NSData *d = newDataWithEncodedPort([self recvPort]);