From: Stephen C. <ste...@gm...> - 2006-03-04 06:11:27
|
In short, CL:LISTEN seems to return T on service sockets when -- but not before -- the peer has closed the connection, even when there are no more characters to read, unless I have tried to read a character. [1] Email describing my issue to sbcl-help, including test file demonstrating: http://sourceforge.net/mailarchive/forum.php?thread_id=9620372&forum_id=4133 A better test file is now available at http://scompall.nocandysw.com/sbcl-listen-socket-test.lisp . [2] Reproduction in SLIME (from which this came): http://article.gmane.org/gmane.lisp.slime.devel/4551 Note: GMane web is unavailable at time of writing, and the archive on clnet unfortunately lost on the MIME. With my limited understanding of SBCL's source, as far as I can tell, responsibility for implementing CL:LISTEN for socket streams is turned over to the routines in src;code;fd-stream.lisp. Patch at http://scompall.nocandysw.com/listen-socket-eof.diff . Suggestions for improvement are appreciated and welcome. Apologies for not making this diff against CVS rather than 0.9.10; at this time, anonymous CVS seems to be unavailable. A kind of changelog entry: src/code/fd-stream.lisp (fd-stream-misc-routine): Do a refill-buffer/fd if select says the fd is readable, to see whether that means "has data" or "at eof". -- Stephen Compall Email: My username is s11. My domain is member..org, but insert the abbreviation for `Free Software Foundation' between the dots. |
From: Stephen C. <ste...@gm...> - 2006-03-13 01:57:02
|
New patch at http://scompall.nocandysw.com/listen-socket-eof-2.diff . On Sat, 04 Mar 2006 00:04:00 -0600, Stephen Compall wrote: >> In short, CL:LISTEN seems to return T on service sockets when -- >> but not before -- the peer has closed the connection, even when >> there are no more characters to read, unless I have tried to read a >> character. >> >> Suggestions for improvement are appreciated and welcome. >> >> A kind of changelog entry: >> >> src/code/fd-stream.lisp [fd-stream-misc-routine]: Do a >> refill-buffer/fd if select says the fd is readable, to see whether >> that means "has data" or "at eof". jsnell wrote on IRC: > the comment should explain the motivation behind the call to > refill-buffer/fd (i.e. that select and cl:listen have different eof > semantics), since it's a pretty subtle point. and the tests should > be integrated into the sbcl regression test suite (or the > sb-bsd-socket test suite) In this version, I moved the multiple uses of unix-fast-select for the purposes of testing a single FD into a function. I also added a test to stream.pure.lisp. To demonstrate the issue, simply evaluate the single form that I added to the test suite. -- Stephen Compall Email: My username is s11. My domain is member..org, but insert the abbreviation for `Free Software Foundation' between the dots. |
From: Juho S. <js...@ik...> - 2006-03-15 04:30:51
|
<ste...@gm...> wrote: > New patch at http://scompall.nocandysw.com/listen-socket-eof-2.diff . [...] > In this version, I moved the multiple uses of unix-fast-select for the > purposes of testing a single FD into a function. I also added a test > to stream.pure.lisp. Thanks! Committed as 0.9.10.33. -- Juho Snellman |