io.sockets.unix: using getsockopt doesn't need to recurse.
parent
82d4b1d67e
commit
ebfa9402d4
|
@ -50,18 +50,10 @@ M: object (get-remote-address)
|
||||||
: init-client-socket ( fd -- )
|
: init-client-socket ( fd -- )
|
||||||
SOL_SOCKET SO_OOBINLINE set-socket-option ;
|
SOL_SOCKET SO_OOBINLINE set-socket-option ;
|
||||||
|
|
||||||
DEFER: wait-to-connect
|
|
||||||
|
|
||||||
: wait-for-output ( port -- )
|
|
||||||
dup +output+ wait-for-port wait-to-connect ; inline
|
|
||||||
|
|
||||||
: wait-to-connect ( port -- )
|
: wait-to-connect ( port -- )
|
||||||
dup handle>> SOL_SOCKET SO_ERROR get-socket-option {
|
dup +output+ wait-for-port
|
||||||
{ 0 [ drop ] }
|
dup handle>> SOL_SOCKET SO_ERROR get-socket-option
|
||||||
{ EAGAIN [ wait-for-output ] }
|
[ drop ] [ (throw-errno) ] if-zero ; inline
|
||||||
{ EINTR [ wait-to-connect ] }
|
|
||||||
[ (throw-errno) ]
|
|
||||||
} case ;
|
|
||||||
|
|
||||||
M: object establish-connection
|
M: object establish-connection
|
||||||
2dup
|
2dup
|
||||||
|
@ -69,7 +61,7 @@ M: object establish-connection
|
||||||
connect 0 = [ 2drop ] [
|
connect 0 = [ 2drop ] [
|
||||||
errno {
|
errno {
|
||||||
{ EINTR [ establish-connection ] }
|
{ EINTR [ establish-connection ] }
|
||||||
{ EINPROGRESS [ drop wait-for-output ] }
|
{ EINPROGRESS [ drop wait-to-connect ] }
|
||||||
[ (throw-errno) ]
|
[ (throw-errno) ]
|
||||||
} case
|
} case
|
||||||
] if ;
|
] if ;
|
||||||
|
|
Loading…
Reference in New Issue