When using threads and sockets, the stream is a two-way streams and its components must be closed separately.

This commit is contained in:
Juan Jose Garcia Ripoll 2010-02-13 15:35:42 +01:00
parent b486b14e9e
commit 113dd3c2ef

View file

@ -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")))