Hi, Anton
Thank you very much for looking into this issue and finally fixed it! I believe this also closed another open issue reported by other users on Hunchentoot mailing list, in which they have to disable the use of READY-ONLY argument when calling WAIT-FOR-INPUT.
Any way, I've merged your patch (r640 on usocket 0.5.x branch [1]), and hope we can make another quick release (0.5.2) in next week, with at least one more planned new feature.
Best Regards,
Chun Tian (binghe)
[1] svn://common-lisp.net/project/usocket/svn/usocket/branches/0.5.x
在 2011-4-10,13:02, Anton Vodonosov 写道:
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