[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 02/02: web: 'tls-wrap' returns an unbuffered custom port
From: |
Ludovic Courtès |
Subject: |
[Guile-commits] 02/02: web: 'tls-wrap' returns an unbuffered custom port. |
Date: |
Fri, 19 Mar 2021 09:14:31 -0400 (EDT) |
civodul pushed a commit to branch master
in repository guile.
commit c92f2c7df0532b9f44dea59e68e1079e9504371b
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Fri Mar 19 14:13:31 2021 +0100
web: 'tls-wrap' returns an unbuffered custom port.
This mirrors Guix commit b168acae2a01fd84075cc134a6140594a978fde5.
* module/web/client.scm (tls-wrap)[unbuffered]: New procedure.
Pass the result of 'make-custom-binary-input/output-port' to
'unbuffered'.
---
module/web/client.scm | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/module/web/client.scm b/module/web/client.scm
index 76d9cc4..3bd22f8 100644
--- a/module/web/client.scm
+++ b/module/web/client.scm
@@ -274,17 +274,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).
;; 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-reference uri-or-string)
(cond