web: server: Handle client disconnection.

* src/web/server/fiberized.scm (client-loop): Catch EPIPE and ECONNRESET
errors than can be thrown if the client disconnects prematurely.
This commit is contained in:
Mathieu Othacehe 2020-07-29 19:24:36 +02:00
parent 6ad9c60269
commit 0955a11abd
No known key found for this signature in database
GPG Key ID: 8354763531769CA6
1 changed files with 7 additions and 1 deletions

View File

@ -150,7 +150,13 @@
(setsockopt client SOL_SOCKET SO_SNDBUF
(* 128 1024))
(if (file-port? output)
(sendfile output input size)
(catch 'system-error
(lambda ()
(sendfile output input size))
(lambda args
(unless (memv (system-error-errno args)
(list EPIPE ECONNRESET))
(apply throw args))))
(dump-port input output))
(close-port output)
(values))))))