When using threads and sockets, the stream is a two-way streams and its components... ECL.10.2.1
authorJuan Jose Garcia Ripoll <jjgarcia@jjgr-2.local>
Sat, 13 Feb 2010 14:35:42 +0000 (15:35 +0100)
committerJuan Jose Garcia Ripoll <jjgarcia@jjgr-2.local>
Sat, 13 Feb 2010 14:35:42 +0000 (15:35 +0100)
contrib/sockets/sockets.lisp

index b9906e3..88d08df 100755 (executable)
@@ -422,7 +422,13 @@ SB-SYS:MAKE-FD-STREAM."))
   (let ((fd (socket-file-descriptor socket)))
     (unless (eql fd -1) ; already closed
       (cond ((slot-boundp socket 'stream)
-            (close (slot-value socket 'stream)) ;; closes fd indirectly
+             (let ((stream (slot-value socket 'stream)))
+               #+threads
+               (close (two-way-stream-input stream))
+               #+threads
+               (close (two-way-stream-output stream))
+               #-threads
+               (close stream)) ;; closes fd indirectly
             (slot-makunbound socket 'stream))
            ((= (socket-close-low-level socket) -1)
             (socket-error "close")))