Re: patch: half closed stuff

From: Adrian Chadd <adrian@dont-contact.us>
Date: Sun, 22 Feb 2004 23:42:30 -0700

On Sun, Feb 22, 2004, Adrian Chadd wrote:
> On Mon, Feb 23, 2004, Henrik Nordstrom wrote:
> > On Sun, 22 Feb 2004, Adrian Chadd wrote:
> >
> > > * exports a commIfHalfClosed(fd) routine..
> > > * .. which I then use in ConnStateData::readSomeData() to
> > > make 100% sure I'm not reading any data from that fd..
> >
> > I would prefer if this done a little earlier, even prevening the attempt
> > of trying to read the next request. From a quick inspection this would be
> > in ConnStateData::readNextRequest.
>
> I can do that. I could even move it into keepaliveNextRequest()..

.. which isn't "right".

Here's what I'm seeing:

* lftp is pipelining a few (few being >1) requests, w/ Keepalive set
* I ctrl-C it
* the read side returns EOF, but there's one outstanding request
    and some data in the conn buf.
* .. so, the socket gets marked as half-closed
* Then, in writeComplete(), since keepalive is set, we get
  a STREAM_COMPLETE
* .. so, keepaliveNextRequest() is called
* .. which schedules another read.

Now, if we just close the client side at the STREAM_COMPLETE,
since a half-closed connection shouldn't be requesting anything more,
then everything is happy. Connections immediately are closed.

The trouble is this: what do we do if there's still data in the
conn in buf? Should we try to parse it and kick start it as another
request? Or, do we just give up at this point and throw all the
subsequent requests away?

Adrian, highly puzzled at the stream code.
Received on Sun Feb 22 2004 - 23:42:32 MST

This archive was generated by hypermail pre-2.1.9 : Mon Mar 01 2004 - 12:00:04 MST