mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-09 13:30:26 +02:00
web: 'tls-wrap' retries handshake upon non-fatal errors.
Fixes <https://bugs.gnu.org/49223>. Reported by Domagoj Stolfa <ds815@gmx.com>. Backport of Guix commit b36267b1d96ac344d2b42c9822ce04b4c3117f85. * guix/build/download.scm (tls-wrap): Retry up to 5 times when 'handshake' throws a non-fatal error.
This commit is contained in:
parent
c01ca10b3f
commit
317b06bf86
1 changed files with 21 additions and 15 deletions
|
@ -259,6 +259,7 @@ host name without trailing dot."
|
|||
;;(set-log-level! 10)
|
||||
;;(set-log-procedure! log)
|
||||
|
||||
(let loop ((retries 5))
|
||||
(catch 'gnutls-error
|
||||
(lambda ()
|
||||
(handshake session))
|
||||
|
@ -271,9 +272,14 @@ host name without trailing dot."
|
|||
(alert-description->string (alert-get session)))
|
||||
(handshake session))
|
||||
(else
|
||||
;; XXX: We'd use 'gnutls_error_is_fatal' but (gnutls) doesn't
|
||||
;; provide a binding for this.
|
||||
(apply throw key err proc rest)))))
|
||||
(if (or (fatal-error? err) (zero? retries))
|
||||
(apply throw key err proc rest)
|
||||
(begin
|
||||
;; We got 'error/again' or similar; try again.
|
||||
(format (current-error-port)
|
||||
"warning: TLS non-fatal error: ~a~%"
|
||||
(error->string err))
|
||||
(loop (- retries 1)))))))))
|
||||
|
||||
;; Verify the server's certificate if needed.
|
||||
(when verify-certificate?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue