[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Mathieu Othacehe |
Date: |
Wed, 29 Jul 2020 14:46:58 -0400 (EDT) |
branch: master
commit 0955a11abd9e27c96a1375cca6a1c97869b5780a
Author: Mathieu Othacehe <othacehe@gnu.org>
AuthorDate: Wed Jul 29 19:24:36 2020 +0200
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.
---
src/web/server/fiberized.scm | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
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))))))