mirror of
https://github.com/gnustep/libs-base.git
synced 2025-06-02 09:31:07 +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
c2998a19a4
commit
ea66a0858c
2 changed files with 13 additions and 4 deletions
|
@ -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]);
|
||||||
|
|
|
@ -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]);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue