httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Roy T. Fielding" <>
Subject Re: client connection questions
Date Fri, 04 Sep 1998 07:22:29 GMT
>If ap_rwrite/ap_bwrite returns -1, does that *always* mean the connection
>is broken?  

It means a fatal error occurred on the write and the buffer is now in an
unknown state, so it is a pretty good bet that the connection is no
longer useful.  Note that EAGAIN (EWOULDBLOCK) and EINTR are the only
non-fatal errors.

>r->connection->aborted is only set if a soft_timeout happens, why not with
>hard_timeout too?

Because a hard_timeout results in a longjump completely out of the
request handling process.

>What is the "right" test to find out if the connection has been broken? 

Check for an error from the ap_rwrite/ap_bwrite calls.

>Here are two checks that seem right by eyeballing the source code, but
>leave eyes sore.
>if(r->connection->client->flags & B_EOUT) {
>    ... connection was broken ...

Actually, that is an internal flag that says the buffer is out-of-whack
and there is no point in trying to send any more data.  I wouldn't use
it outside the core.

>if(r->connection->client->fd < 0) {
>     ... connection was broken ...

That means the file descriptor has been closed.

I suppose what we should have is an ap_is_connection_dead(r) macro,
but just checking the return values is simpler.


View raw message