More Unix I/O work

db4
Slava Pestov 2008-05-13 23:36:15 -05:00
parent 318f0875a1
commit 47f1c31261
2 changed files with 10 additions and 8 deletions

View File

@ -23,11 +23,8 @@ $nl
"Per-port native I/O protocol:" "Per-port native I/O protocol:"
{ $subsection init-handle } { $subsection init-handle }
{ $subsection (wait-to-read) } { $subsection (wait-to-read) }
"Additionally, the I/O backend must provide an implementation of the " { $link stream-flush } " and " { $link dispose } " generic words." { $subsection (wait-to-write) }
$nl "Additionally, the I/O backend must provide an implementation of the " { $link dispose } " generic word." ;
"Dummy ports which should be used to implement networking:"
{ $subsection server-port }
{ $subsection datagram-port } ;
ABOUT: "io.ports" ABOUT: "io.ports"

View File

@ -73,6 +73,8 @@ M: ssl-handle drain
M: ssl ((client)) ( addrspec -- handle ) M: ssl ((client)) ( addrspec -- handle )
[ addrspec>> ((client)) <ssl-socket> ] with-destructors ; [ addrspec>> ((client)) <ssl-socket> ] with-destructors ;
M: ssl parse-sockaddr addrspec>> parse-sockaddr ;
: check-connect-response ( port r -- event ) : check-connect-response ( port r -- event )
check-response check-response
{ {
@ -83,10 +85,13 @@ M: ssl ((client)) ( addrspec -- handle )
{ SSL_ERROR_SSL [ (ssl-error) ] } { SSL_ERROR_SSL [ (ssl-error) ] }
} case ; } case ;
: do-ssl-connect ( port ssl -- ) : do-ssl-connect ( port ssl addrspec -- )
drop
2dup SSL_connect check-connect-response dup 2dup SSL_connect check-connect-response dup
[ nip wait-for-port ] [ 3drop ] if ; [ nip wait-for-port ] [ 3drop ] if ;
M: ssl-handle (wait-to-connect) M: ssl-handle (wait-to-connect)
[ file>> (wait-to-connect) ] addrspec>>
[ handle>> do-ssl-connect ] 2bi ; [ >r file>> r> (wait-to-connect) ]
[ >r handle>> r> do-ssl-connect ]
3bi ;