Re: patch: half closed stuff

From: Adrian Chadd <adrian@dont-contact.us>
Date: Mon, 23 Feb 2004 00:43:48 -0700

On Sun, Feb 22, 2004, Adrian Chadd wrote:

> > 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?

Here's a patch which implements the latter behaviour.
It seems to Do The Right Thing(tm), which is to immediately close
the connection after the last request has been tried when we've
been turned half-closed.

I'm not sure whether this will interfere with "normal" behaviour, but
then, how else do we deal with the situation where we have a half-closed
connection with pipelined requests? :)

Adrian
Received on Mon Feb 23 2004 - 00:43:49 MST

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