Definition of USOCKET class has the comment the %READY-P slot is reset by SOCKET-ACCEPT function. But right now SOCKET-ACCEPT does not reset it, hence WAIT-FOR-INPUT will not actuall wait after the first it time it notices the readiness.
Also, SB-BSD-SOCKETS:SOCKET-ACCEPT may return NIL (if accept call returned EWOULDBLOCK, for example), and USOCKET:SOCKET-ACCEPT will try to use it. Attached is a patch that fixes these two issues.
Index: backend/sbcl.lisp
===================================================================
--- backend/sbcl.lisp (revision 562)
+++ backend/sbcl.lisp (working copy)
@@ -284,13 +284,15 @@
(defmethod socket-accept ((socket stream-server-usocket) &key element-type)
(with-mapped-conditions (socket)
(let ((sock (sb-bsd-sockets:socket-accept (socket socket))))
- (make-stream-socket
- :socket sock
- :stream (sb-bsd-sockets:socket-make-stream
- sock
- :input t :output t :buffering :full
- :element-type (or element-type
- (element-type socket)))))))
+ (setf (%ready-p socket) nil)
+ (when sock
+ (make-stream-socket
+ :socket sock
+ :stream (sb-bsd-sockets:socket-make-stream
+ sock
+ :input t :output t :buffering :full
+ :element-type (or element-type
+ (element-type socket))))))))
;; Sockets and their associated streams are modelled as
;; different objects. Be sure to close the stream (which
signature.asc
Description: This is a digitally signed message part
_______________________________________________ usocket-devel mailing list [email protected] http://common-lisp.net/cgi-bin/mailman/listinfo/usocket-devel
