mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2025-01-22 18:49:14 -05:00
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.
This commit is contained in:
parent
ed63b7f87e
commit
9158020d78
1 changed files with 5 additions and 1 deletions
|
@ -43,6 +43,7 @@ (define-module (guix scripts substitute)
|
||||||
(open-connection-for-uri
|
(open-connection-for-uri
|
||||||
. guix:open-connection-for-uri)
|
. guix:open-connection-for-uri)
|
||||||
store-path-abbreviation byte-count->string))
|
store-path-abbreviation byte-count->string))
|
||||||
|
#:autoload (gnutls) (error/invalid-session)
|
||||||
#:use-module (guix progress)
|
#:use-module (guix progress)
|
||||||
#:use-module ((guix build syscalls)
|
#:use-module ((guix build syscalls)
|
||||||
#:select (set-thread-name))
|
#:select (set-thread-name))
|
||||||
|
@ -1054,9 +1055,12 @@ (define* (call-with-cached-connection uri proc
|
||||||
;; If PORT was cached and the server closed the connection in the
|
;; If PORT was cached and the server closed the connection in the
|
||||||
;; meantime, we get EPIPE. In that case, open a fresh connection and
|
;; meantime, we get EPIPE. In that case, open a fresh connection and
|
||||||
;; retry. We might also get 'bad-response or a similar exception from
|
;; 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)
|
(if (or (and (eq? key 'system-error)
|
||||||
(= EPIPE (system-error-errno `(,key ,@args))))
|
(= 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)))
|
(memq key '(bad-response bad-header bad-header-component)))
|
||||||
(proc (open-connection uri #:fresh? #t))
|
(proc (open-connection uri #:fresh? #t))
|
||||||
(apply throw key args))))))
|
(apply throw key args))))))
|
||||||
|
|
Loading…
Reference in a new issue