mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
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:
parent
4e6a7e777c
commit
08ee139d3f
2 changed files with 13 additions and 4 deletions
|
@ -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]);
|
||||
|
|
|
@ -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]);
|
||||
|
|
Loading…
Reference in a new issue