Timeout is not honored
zellerin opened this issue · comments
I believe that the timeout in try-server is not honored; unless you provide :ready-only
to wait-for-input
, it returns original socket and never nil
, so when
body is always run and socket-receive
then blocks.
Simple fix: add :ready-only t
.
Also, :timeout 1
on socket-connect
somehow does not look right.
From the usocket documentation:
It returns two values: the first is the list of sockets which are readable (or in case of server sockets acceptable). nil may be returned for this value either when waiting timed out or when it was interrupted (EINTR). The second value is a real number indicating the time remaining within the timeout period or nil if none.
Which implementation did you test this on?
SBCL, quicklisp version of usocket (usocket-0.8.3).
My version of usocket doc continues:
Without the READY-ONLY arg, WAIT-FOR-INPUT will return all sockets in
the original list you passed it. This prevents a new list from being
consed up. Some users of USOCKET were reluctant to use it if it
wouldn't behave that way, expecting it to cost significant performance
to do the associated garbage collection.
Without the READY-ONLY arg, you need to check the socket STATE slot for
the values documented in usocket.lisp in the usocket class.
Confirmed and implemented the fix now. Thanks a lot for the report!