guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

02/05: substitute: Handle "invalid session" GnuTLS errors on reused conn


From: guix-commits
Subject: 02/05: substitute: Handle "invalid session" GnuTLS errors on reused connections.
Date: Mon, 4 Jan 2021 05:53:46 -0500 (EST)

civodul pushed a commit to branch master
in repository guix.

commit 9158020d7853b6e7925802e0d0a082801c680e8f
Author: Ludovic Court├Ęs <ludo@gnu.org>
AuthorDate: Mon Jan 4 11:05:58 2021 +0100

    substitute: Handle "invalid session" GnuTLS errors on reused connections.
    
    Reported by Christopher Baines <mail@cbaines.net>
    at <https://issues.guix.gnu.org/45323#2>.
    
    * guix/scripts/substitute.scm (call-with-cached-connection): Handle
    'gnutls-error and ERROR/INVALID-SESSION.
---
 guix/scripts/substitute.scm | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/guix/scripts/substitute.scm b/guix/scripts/substitute.scm
index 8084c89..e53de8c 100755
--- a/guix/scripts/substitute.scm
+++ b/guix/scripts/substitute.scm
@@ -43,6 +43,7 @@
                           (open-connection-for-uri
                            . guix:open-connection-for-uri)
                           store-path-abbreviation byte-count->string))
+  #:autoload   (gnutls) (error/invalid-session)
   #:use-module (guix progress)
   #:use-module ((guix build syscalls)
                 #:select (set-thread-name))
@@ -1054,9 +1055,12 @@ server certificates."
         ;; If PORT was cached and the server closed the connection in the
         ;; meantime, we get EPIPE.  In that case, open a fresh connection and
         ;; retry.  We might also get 'bad-response or a similar exception from
-        ;; (web response) later on, once we've sent the request.
+        ;; (web response) later on, once we've sent the request, or a
+        ;; ERROR/INVALID-SESSION from GnuTLS.
         (if (or (and (eq? key 'system-error)
                      (= EPIPE (system-error-errno `(,key ,@args))))
+                (and (eq? key 'gnutls-error)
+                     (eq? (first args) error/invalid-session))
                 (memq key '(bad-response bad-header bad-header-component)))
             (proc (open-connection uri #:fresh? #t))
             (apply throw key args))))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]