me
/
guix
Archived
1
0
Fork 0

download: 'tls-wrap' returns an unbuffered custom port.

Partly fixes <https://bugs.gnu.org/46967>.

* guix/build/download.scm (tls-wrap)[unbuffered]: New procedure.
Pass the result of 'make-custom-binary-input/output-port' to
'unbuffered'.
master
Ludovic Courtès 2021-03-10 23:13:23 +01:00
parent 279d932b1c
commit b168acae2a
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 10 additions and 3 deletions

View File

@ -323,17 +323,24 @@ host name without trailing dot."
(unless (port-closed? record)
(close-port record)))
(define (unbuffered port)
(setvbuf port 'none)
port)
(setvbuf record 'block)
;; Return a port that wraps RECORD to ensure that closing it also
;; closes PORT, the actual socket port, and its file descriptor.
;; Make sure it does not introduce extra buffering (custom ports
;; are buffered by default as of Guile 3.0.5).
;; XXX: This wrapper would be unnecessary if GnuTLS could
;; automatically close SESSION's file descriptor when RECORD is
;; closed, but that doesn't seem to be possible currently (as of
;; 3.6.9).
(make-custom-binary-input/output-port "gnutls wrapped port" read! write!
get-position set-position!
close))))
(unbuffered
(make-custom-binary-input/output-port "gnutls wrapped port" read! write!
get-position set-position!
close)))))
(define (ensure-uri uri-or-string) ;XXX: copied from (web http)
(cond