From ebfa9402d41437de12b34093205a25fbbddb5d15 Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Mon, 14 Mar 2016 08:42:54 -0700 Subject: [PATCH] io.sockets.unix: using getsockopt doesn't need to recurse. --- basis/io/sockets/unix/unix.factor | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/basis/io/sockets/unix/unix.factor b/basis/io/sockets/unix/unix.factor index 3078b83aeb..594533805e 100644 --- a/basis/io/sockets/unix/unix.factor +++ b/basis/io/sockets/unix/unix.factor @@ -50,18 +50,10 @@ M: object (get-remote-address) : init-client-socket ( fd -- ) 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 -- ) - dup handle>> SOL_SOCKET SO_ERROR get-socket-option { - { 0 [ drop ] } - { EAGAIN [ wait-for-output ] } - { EINTR [ wait-to-connect ] } - [ (throw-errno) ] - } case ; + dup +output+ wait-for-port + dup handle>> SOL_SOCKET SO_ERROR get-socket-option + [ drop ] [ (throw-errno) ] if-zero ; inline M: object establish-connection 2dup @@ -69,7 +61,7 @@ M: object establish-connection connect 0 = [ 2drop ] [ errno { { EINTR [ establish-connection ] } - { EINPROGRESS [ drop wait-for-output ] } + { EINPROGRESS [ drop wait-to-connect ] } [ (throw-errno) ] } case ] if ;