guile-commits
[Top][All Lists]
Advanced

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

[Guile-commits] 01/01: web: Update comment regarding the 'tls-wrap' port


From: Ludovic Courtès
Subject: [Guile-commits] 01/01: web: Update comment regarding the 'tls-wrap' port wrapper.
Date: Fri, 3 Jan 2020 09:45:59 -0500 (EST)

civodul pushed a commit to branch stable-2.2
in repository guile.

commit fb7b873afa29f707d74c47ac41153b18cf165737
Author: Ludovic Courtès <address@hidden>
Date:   Fri Jan 3 15:44:54 2020 +0100

    web: Update comment regarding the 'tls-wrap' port wrapper.
    
    * module/web/client.scm (tls-wrap): Update comment.
---
 module/web/client.scm | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/module/web/client.scm b/module/web/client.scm
index 6c542f9..c777a8d 100644
--- a/module/web/client.scm
+++ b/module/web/client.scm
@@ -1,6 +1,6 @@
 ;;; Web client
 
-;; Copyright (C) 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 Free Software 
Foundation, Inc.
+;; Copyright (C) 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2020 Free 
Software Foundation, Inc.
 
 ;; This library is free software; you can redistribute it and/or
 ;; modify it under the terms of the GNU Lesser General Public
@@ -131,12 +131,7 @@ host name without trailing dot."
     ;;(set-log-procedure! log)
 
     (handshake session)
-    ;; FIXME: It appears that session-record-port is entirely
-    ;; sufficient; it's already a port.  The only value of this code is
-    ;; to keep a reference on "port", to keep it alive!  To fix this we
-    ;; need to arrange to either hand GnuTLS its own fd to close, or to
-    ;; arrange a reference from the session-record-port to the
-    ;; underlying socket.
+
     (let ((record (session-record-port session)))
       (define (read! bv start count)
         (define read-bv (get-bytevector-some record))
@@ -160,7 +155,15 @@ host name without trailing dot."
           (close-port port))
         (unless (port-closed? record)
           (close-port record)))
+
       (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.
+      ;; 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))))



reply via email to

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