Re: half-closed connections?

From: Henrik Nordstrom <hno@dont-contact.us>
Date: Fri, 20 Feb 2004 14:19:38 +0100 (CET)

On Fri, 20 Feb 2004, Adrian Chadd wrote:

> * i start mirroring something via lftp
> * lftp uses Keepalive in its HTTP requests
> * I hit ctrl-C in lftp
> * a client fd does this:
> - read handler gets called, size 0
> - commMarkHalfClosed() is called
> - ... no more IO is scheduled
> - write handler gets called, sucessful write
> - since Keepalive, the next request is scheduled
> - .. so, a comm_read is issued ..
> - .. which schedules a read ..
> - read returns size 0 since yes, the socket has gone away
> - commMarkHalfClosed() is called
> - but, since the socket is already marked as half-closed, we get an assert and
> it all goes pear shaped

Yes, and the problem is that you should not start reading a new request on
a closed connection. If the connection is already known to be closed you
know that there is no way there can be a request read from the connection.

You should still process already read requests however.

And no, this is not related to FTP. Just reading of requests from a client
connection.

> Now, my questions:
>
> * in ConnStateData::readSomeData(), is it ok to just return if the socket
> is marked as half closed? Will a half-closed socket ever be re-opened
> somehow?

A half-closed socket will never get reopened. The client->server channel
is permanently closed.

> * what is the whole point of AbortChecker? As far as I can tell
> AbortChecker::doIOLoop() isn't being called at all. I've modified it
> to actually be called once a second, with no ill effects.

Robert?

Regards
Henrik
Received on Fri Feb 20 2004 - 06:19:41 MST

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