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:
rfm 2006-11-30 09:00:44 +00:00
parent c2998a19a4
commit ea66a0858c
2 changed files with 13 additions and 4 deletions

View file

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

View file

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