[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Mathieu Othacehe |
Date: |
Sat, 6 Feb 2021 03:43:35 -0500 (EST) |
branch: master
commit eea91d9a63c83893c78bc987c0fd96f023e7601b
Author: Mathieu Othacehe <othacehe@gnu.org>
AuthorDate: Sat Feb 6 09:42:54 2021 +0100
remote: Swallow zlib errors.
* src/cuirass/remote.scm (swallow-zlib-error): New macro.
(send-log): Use it.
---
src/cuirass/remote.scm | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/src/cuirass/remote.scm b/src/cuirass/remote.scm
index 33442e6..895c99c 100644
--- a/src/cuirass/remote.scm
+++ b/src/cuirass/remote.scm
@@ -329,6 +329,13 @@ PRIVATE-KEY to sign narinfos."
(set-thread-name "log-server")
(wait-for-client port client-handler))))
+(define-syntax-rule (swallow-zlib-error exp ...)
+ "Swallow 'zlib-error' exceptions raised by EXP..."
+ (catch 'zlib-error
+ (lambda ()
+ exp ...)
+ (const #f)))
+
(define* (send-log address port derivation log)
(let* ((sock (socket AF_INET SOCK_STREAM 0))
(in-addr (inet-pton AF_INET address))
@@ -342,9 +349,10 @@ PRIVATE-KEY to sign narinfos."
(version 0)
(derivation ,derivation))))
(write header sock)
- (call-with-gzip-output-port sock
- (lambda (sock-compressed)
- (dump-port log sock-compressed)))
+ (swallow-zlib-error
+ (call-with-gzip-output-port sock
+ (lambda (sock-compressed)
+ (dump-port log sock-compressed))))
(close-port sock)))
(x
(log-message "invalid handshake ~s.~%" x)