simpler eof handling

module-based-network
Daniel Barlow 2023-02-15 19:50:00 +00:00
parent b84a6e0aa5
commit 1b372bcb2b
1 changed files with 2 additions and 8 deletions

View File

@ -33,15 +33,9 @@
(values
(fn handler [reqlen]
(let [bytes (f:read reqlen)]
(if eof?
false
bytes
(if bytes
(values true bytes)
(do
;; if the file length is divisible by the block
;; length, need to send an empty block at eof
(set eof? true)
(values true "")))))
(values false nil))))
size))
(error "host not allowed")))
nil