Preparing io.nonblocking for SSL

db4
Slava Pestov 2008-05-11 17:44:39 -05:00
parent c59e17d483
commit 18fe2d0047
3 changed files with 8 additions and 8 deletions

View File

@ -57,7 +57,7 @@ M: object cancel-io drop ;
M: port timed-out cancel-io ;
GENERIC: (wait-to-read) ( port -- )
HOOK: (wait-to-read) io-backend ( port -- )
: wait-to-read ( count port -- )
tuck buffer>> buffer-length > [ (wait-to-read) ] [ drop ] if ;
@ -126,16 +126,16 @@ M: output-port stream-write
[ buffer>> >buffer ] 2bi
] if ;
GENERIC: port-flush ( port -- )
HOOK: flush-port io-backend ( port -- )
M: output-port stream-flush ( port -- )
check-closed
[ port-flush ] [ pending-error ] bi ;
[ flush-port ] [ pending-error ] bi ;
GENERIC: close-port ( port -- )
M: output-port close-port
[ port-flush ] [ call-next-method ] bi ;
[ flush-port ] [ call-next-method ] bi ;
M: port close-port
dup cancel-io

View File

@ -148,7 +148,7 @@ M: read-task do-io-task
io-task-port dup refill
[ [ reader-eof ] [ drop ] if ] keep ;
M: input-port (wait-to-read)
M: unix (wait-to-read)
[ <read-task> add-io-task ] with-port-continuation
pending-error ;
@ -179,7 +179,7 @@ M: write-task do-io-task
: (wait-to-write) ( port -- )
[ add-write-io-task ] with-port-continuation drop ;
M: output-port port-flush ( port -- )
M: unix flush-port ( port -- )
dup buffer>> buffer-empty? [ drop ] [ (wait-to-write) ] if ;
M: unix io-multiplex ( ms/f -- )

View File

@ -85,7 +85,7 @@ M: winnt open-append
: flush-output ( port -- )
[ [ (flush-output) ] with-timeout ] with-destructors ;
M: port port-flush
M: winnt flush-port
dup buffer>> buffer-empty? [ dup flush-output ] unless drop ;
: finish-read ( overlapped port -- )
@ -106,5 +106,5 @@ M: port port-flush
finish-read
] [ 2drop ] if ;
M: input-port (wait-to-read) ( port -- )
M: winnt (wait-to-read) ( port -- )
[ [ ((wait-to-read)) ] with-timeout ] with-destructors ;