[iolib-devel] Bug when using READ-LINE on non-blocking fds
Chaitanya Gupta
mail at chaitanyagupta.com
Sat Feb 7 19:18:10 UTC 2009
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?
Chaitanya
More information about the iolib-devel
mailing list