Converting to block buffering and flushing

svn: r963
This commit is contained in:
Jay McCarthy 2005-10-04 12:52:18 +00:00
parent 8b6f6f87f6
commit eec8a3ec9a
2 changed files with 10 additions and 11 deletions

View File

@ -115,7 +115,9 @@
;; output-response: connection response -> void
(define (ext:output-response conn resp)
(call-with-semaphore (connection-mutex conn)
(lambda () (output-response conn resp))))
(lambda ()
(output-response conn resp)
(flush-output (connection-o-port conn)))))
(define (output-response conn resp)
(cond
@ -180,7 +182,9 @@
;; output-file: connection path symbol bytes -> void
(define (ext:output-file conn file-path method mime-type)
(call-with-semaphore (connection-mutex conn)
(lambda () (output-file conn file-path method mime-type))))
(lambda ()
(output-file conn file-path method mime-type)
(flush-output (connection-o-port conn)))))
(define (output-file conn file-path method mime-type)
(output-headers conn 200 "Okay"
@ -199,7 +203,9 @@
;; If it is a head request output headers only, otherwise output as usual
(define (ext:output-response/method conn resp meth)
(call-with-semaphore (connection-mutex conn)
(lambda () (output-response/method conn resp meth))))
(lambda ()
(output-response/method conn resp meth)
(flush-output (connection-o-port conn)))))
(define (output-response/method conn resp meth)
(cond

View File

@ -60,14 +60,7 @@
(let ([listener (tcp-listen config:port config:max-waiting
#t config:listen-ip)])
(let ([get-ports
(lambda ()
(let-values ([(ip op) (tcp-accept listener)])
;; Try to set buffer mode, and if it can't be set,
;; assume that it doesn't matter. (Only happens
;; when tcp-accept is not MzScheme's version.)
(with-handlers ([exn:fail? void])
(file-stream-buffer-mode op 'none))
(values ip op)))])
(lambda () (tcp-accept listener))])
(thread
(lambda ()
(with-handlers ([void (lambda (e)