[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Mathieu Othacehe |
Date: |
Fri, 17 Dec 2021 09:09:48 -0500 (EST) |
branch: master
commit 4b7bc873b35b59e3ca83a7ef6ab01fb1f0059f30
Author: Mathieu Othacehe <othacehe@gnu.org>
AuthorDate: Fri Dec 17 15:09:04 2021 +0100
remote: Handle client premature disconnections.
* src/cuirass/remote.scm (receive-logs): Catch premature client
disconnections
and report them.
---
src/cuirass/remote.scm | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/src/cuirass/remote.scm b/src/cuirass/remote.scm
index 45f6c63..3513a81 100644
--- a/src/cuirass/remote.scm
+++ b/src/cuirass/remote.scm
@@ -298,9 +298,16 @@ PRIVATE-KEY to sign narinfos."
(((_) () ())
(match (accept sock)
((client . address)
- (write '(log-server (version 0)) client)
- (force-output client)
- (proc client))))
+ (catch 'system-error
+ (lambda ()
+ (write '(log-server (version 0)) client)
+ (force-output client)
+ (proc client))
+ (lambda args
+ (let ((errno (system-error-errno args)))
+ (when (memv errno (list EPIPE ECONNRESET ECONNABORTED))
+ (log-error "~a when replying to ~a."
+ (strerror errno) (fileno client)))))))))
((() () ())
#f)))))