On Sun, 2009-02-08 at 00:48 +0530, Chaitanya Gupta wrote:
Hi,
Iolib behaves in the following way when using READ-LINE with a non-blocking fd:
;; *client-stream is the stream associated with a client connected to our server
IRCD> *client-stream #<active IPv6 stream socket connected to ::ffff:127.0.0.1/41460 {1004D5D451}>
IRCD> (fd-non-blocking *) T
;; client sends the string "foo" down the socket, no newline is sent
IRCD> (ignore-errors (read-line *client-stream)) NIL #<System-Error EWOULDBLOCK(11) "Resource temporarily unavailable">
;; client sends the string "bar", followed by a newline
IRCD> (ignore-errors (read-line *client-stream)) "bar" NIL
So, essentially, the string "foo" is lost. Shouldn't the correct behaviour be to wait till a newline arrives on the socket?
That's correct. Thanks for the notice, I've just pushed a fix ;)