Hello.

I am using usocket 0.5.0 and it has a bug for CLISP.

In the function wait-for-input-internal there is a do* cycle which analyzes
the result of the CLISP function socket-status
(its docs are here: http://www.clisp.org/impnotes/socket.html#so-status)

Here is how the cycle is written now:

        (do* ((x (pop sockets) (pop sockets))
              (y (pop status-list) (pop status-list)))
             ((null x))
          (when (eq y :INPUT)
            (setf (state x) :READ)))

This cycle never recognizes that a server socket is ready to accept a 
connection.

The fixed cycle

        (do* ((x (pop sockets) (pop sockets))
              (y (cdr (pop status-list)) (cdr (pop status-list)))) ; <- fixed 
here
             ((null x))
          (when (member y '(T :INPUT)) ; <- and here
            (setf (state x) :READ)))

The first mistake was that the code expects socket-status to return a list of 
statuses,
but it actually returns a list of cons cells, according to the doc:

> If you want to avoid consing[3] up a fresh list, you can make the elements of 
> socket-stream-or-list to be (socket-stream direction . x) or (socket-server . 
> x). 
> Then SOCKET:SOCKET-STATUS will destructively modify its argument and replace
> x or NIL with the status and return the modified list. 

The second mistake is that socket-status specifies ready SOCKET-SERVER as T
(and :INPUTS is for SOCKET-STREAM). As far as I understood usocket intention
for the wait-for-input-internal function, we should check both.

With these changes, I have hunchentoot 1.1.1 working with clisp 2.49.

Best regards,
- Anton

_______________________________________________
usocket-devel mailing list
usocket-devel@common-lisp.net
http://common-lisp.net/cgi-bin/mailman/listinfo/usocket-devel

Reply via email to