aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathieu Othacehe <othacehe@gnu.org>2020-07-29 19:24:36 +0200
committerMathieu Othacehe <othacehe@gnu.org>2020-07-29 19:36:51 +0200
commit0955a11abd9e27c96a1375cca6a1c97869b5780a (patch)
treeb1f6b5494d1cb36d74314a0f91e26e22e1a9edcf
parent6ad9c602697ffe33c8fbb09ccd796b74bf600223 (diff)
downloadcuirass-0955a11abd9e27c96a1375cca6a1c97869b5780a.tar
cuirass-0955a11abd9e27c96a1375cca6a1c97869b5780a.tar.gz
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.
-rw-r--r--src/web/server/fiberized.scm8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/web/server/fiberized.scm b/src/web/server/fiberized.scm
index 7769202..d4674b8 100644
--- a/src/web/server/fiberized.scm
+++ b/src/web/server/fiberized.scm
@@ -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))))))