[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Ludovic Courtès |
Date: |
Wed, 25 Oct 2023 18:01:46 -0400 (EDT) |
branch: master
commit 159cadca3f3548cb04875a776a65b112f143dc9d
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Wed Oct 25 17:55:34 2023 +0200
remote: Improve error messages in ‘send-log’.
* src/cuirass/remote.scm (sockaddr->string): New procedure, moved from…
(receive-logs): … here.
(send-log): Print the zlib error when it occurs. Print the peer’s
address upon invalid handshake.
---
src/cuirass/remote.scm | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/src/cuirass/remote.scm b/src/cuirass/remote.scm
index f4ef49d..7676cb0 100644
--- a/src/cuirass/remote.scm
+++ b/src/cuirass/remote.scm
@@ -280,11 +280,12 @@ PRIVATE-KEY to sign narinfos."
(cut string-take store-hash <>))))
(string-append cache "/" hash ".log.gz")))
-(define (receive-logs port cache)
- (define (sockaddr->string address)
- (inet-ntop (sockaddr:fam address)
- (sockaddr:addr address)))
+(define (sockaddr->string address)
+ "Return a string representation of ADDRESS, a sockaddr."
+ (inet-ntop (sockaddr:fam address)
+ (sockaddr:addr address)))
+(define (receive-logs port cache)
(define (read-log port address)
(let ((address (sockaddr->string address)))
(match (false-if-exception (read port))
@@ -365,11 +366,17 @@ PRIVATE-KEY to sign narinfos."
;; Closing COMPRESSED flushes it so it might throw to
;; 'zlib-error'. Ignore it.
(false-if-exception (close-port compressed))
- (unless (eq? key 'zlib-error)
- (apply throw args)))))
+ (if (eq? key 'zlib-error)
+ (match args
+ ((proc code . _)
+ (log-warning
+ "zlib error in '~a' while sending log to ~a: ~a"
+ proc (sockaddr->string addr) code)))
+ (apply throw args)))))
(close-port sock)))
(x
- (log-error "invalid handshake ~s." x)
+ (log-error "invalid handshake with ~a: ~s"
+ (sockaddr->string addr) x)
(close-port sock)
#f))))
- master updated (966505d -> 0a9776e), Ludovic Courtès, 2023/10/25
- [no subject],
Ludovic Courtès <=
- [no subject], Ludovic Courtès, 2023/10/25
- [no subject], Ludovic Courtès, 2023/10/25
- [no subject], Ludovic Courtès, 2023/10/25
- [no subject], Ludovic Courtès, 2023/10/25
- [no subject], Ludovic Courtès, 2023/10/25
- [no subject], Ludovic Courtès, 2023/10/25
- [no subject], Ludovic Courtès, 2023/10/25
- [no subject], Ludovic Courtès, 2023/10/25