scsh-users
[Top] [All Lists]

Re: maybe read-string/partial bug??

To: shivers@cc.gatech.edu
Subject: Re: maybe read-string/partial bug??
From: "Robert E. Brown" <robert.brown@gs.com>
Date: Tue, 29 May 2001 15:07:31 -0400
Cc: scsh-bugs@zurich.ai.mit.edu
I think I was questioning the generation of an exception for this particular
condition.  It didn't appear to be severe or exceptional enough to me when I
was looking at the code.  Seems more reasonable now, however.

                                bob

====================

   Date: Tue, 29 May 2001 12:16:01 -0400
   From: shivers@cc.gatech.edu

       I've written a little server that uses read- string/partial to get data
       from clients. The server waits in select until data is available, then
       reads from the sockets that select has indicated are readable.

       Sometimes, the read system call on a client socket returns -1 with errno
       set to ECONNRESET, since a client has closed its communications socket.

       The code in generic-read-string!/partial does not catch this case, so my
       server was dying. Is this a bug in read- string/partial?

   I would say not. It's your r-s!/p procedure telling you something unusual
   has happened. 

       I now wrap read-string/partial as follows, which has 
       made the problem go
       away:

            (define (read-carefully port)
              (with-errno-handler
               ((err data) ((errno/connreset) #f))
               (read-string/partial 1024 port)))

       Is this the right approach?

   Since you don't care this case, yes.
       -Olin

<Prev in Thread] Current Thread [Next in Thread>