On Sat, Jun 14, 2008 at 8:23 AM, binghe Chun Tian binghe.lisp@gmail.com wrote:
Hi, usocket developer
Hi!
I think there's two bugs in usocket trunk's backend/lispworks.lisp
Thanks for the report!
- in function USOCKET-LISTEN, you should listen the stream of a usocket,
not the socket fd itself:
(defun usocket-listen (usocket) (if (stream-usocket-p usocket) (when (listen (socket-stream usocket)) usocket) (when (comm::socket-listen (socket usocket)) usocket)))
- in function #-win32 WAIT-FOR-INPUT-INTERNAL, mapcar didn't have a :KEY
keyword:
#-win32 (defun wait-for-input-internal (sockets &key timeout) (with-mapped-conditions () ;; unfortunately, it's impossible to share code between ;; non-win32 and win32 platforms... ;; Can we have a sane -pref. complete [UDP!?]- API next time, please? (mapcar #'(lambda (x) (mp:notice-fd (os-socket-handle x))) sockets) (mp:process-wait-with-timeout "Waiting for a socket to become active" (truncate timeout) #'(lambda (socks) (some #'usocket-listen socks)) sockets) (mapcar #'(lambda (x) (mp:unnotice-fd (os-socket-handle x))) sockets) (remove nil (mapcar #'usocket-listen sockets))))
Hope them can be merged. Thanks.
Absolutely, you're right on both accounts. However, if you don't mind, I'd rather replace the mapcar invocations with dolist forms: they're non-consing.
Bye,
Erik.