[usocket-devel] Patch for backend/lispworks.lisp

Erik Huelsmann e.huelsmann at gmx.net
Sat Jun 14 12:09:42 UTC 2008


On Sat, Jun 14, 2008 at 8:23 AM, binghe Chun Tian <binghe.lisp at gmail.com> wrote:
> Hi, usocket developer

Hi!

> I think there's two bugs in usocket trunk's backend/lispworks.lisp

Thanks for the report!

> 1. 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)))

> 2. 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.



More information about the usocket-devel mailing list