io.sockets.unix: use getsockopt to check connect success.
parent
5b3987a26f
commit
3fdbbe0fea
|
@ -52,13 +52,14 @@ DEFER: wait-to-connect
|
||||||
dup +output+ wait-for-port wait-to-connect ; inline
|
dup +output+ wait-for-port wait-to-connect ; inline
|
||||||
|
|
||||||
: wait-to-connect ( port -- )
|
: wait-to-connect ( port -- )
|
||||||
dup handle>> handle-fd f 0 write 0 = [ drop ] [
|
dup handle>> handle-fd SOL_SOCKET SO_ERROR
|
||||||
errno {
|
-1 int <ref> [ dup byte-length int <ref> getsockopt io-error ] keep int deref
|
||||||
{ EAGAIN [ wait-for-output ] }
|
{
|
||||||
{ EINTR [ wait-to-connect ] }
|
{ 0 [ drop ] }
|
||||||
[ (throw-errno) ]
|
{ EAGAIN [ wait-for-output ] }
|
||||||
} case
|
{ EINTR [ wait-to-connect ] }
|
||||||
] if ;
|
[ (throw-errno) ]
|
||||||
|
} case ;
|
||||||
|
|
||||||
M: object establish-connection
|
M: object establish-connection
|
||||||
2dup
|
2dup
|
||||||
|
|
Loading…
Reference in New Issue