You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Nathan Schrenk <ns...@neog.com> on 1996/01/03 03:24:47 UTC

Re: The Apache timeout code is still braindead? - OOPS

Oops...  it looks like I cut the wrong loop out of send_fd()...
What I really meant was:

This loop

--
while(n && !r->connection->aborted) {
            w=fwrite(&buf[o],sizeof(char),n,c->client);
            n-=w;
            o+=w;
}
--

Could perhaps be changed to this loop:

--
while(n && !r->connection->aborted) {
            w=fwrite(&buf[o],sizeof(char),n,c->client);
            n-=w;
            o+=w;
            if (n) {
                alarm(0);
                signal(SIGALRM,(void (*)())timeout);
            }
}
--

So now what's wrong with it?  (Other than the fact that it adds the 
overhead of a comparison and two function calls in this loop).  Will this 
fix the timeout problem?  What problems does it introduce?  Like I 
mentioned in my last post, I haven't looked into this very deeply.

Nathan

--
Nathan Schrenk						nschrenk@neog.com
Neoglyphics Media Corp.                              http://www.neog.com/


Re: The Apache timeout code is still braindead? - OOPS

Posted by Cliff Skolnick <cl...@organic.com>.
I thought there was another alarm pending here, and the use of
alarm() would mess that one up.  Perhaps apache should use non-blocking I/O
to the socket?

Cliff

On Tue, 2 Jan 1996, Nathan Schrenk wrote:

> 
> Oops...  it looks like I cut the wrong loop out of send_fd()...
> What I really meant was:
> 
> This loop
> 
> --
> while(n && !r->connection->aborted) {
>             w=fwrite(&buf[o],sizeof(char),n,c->client);
>             n-=w;
>             o+=w;
> }
> --
> 
> Could perhaps be changed to this loop:
> 
> --
> while(n && !r->connection->aborted) {
>             w=fwrite(&buf[o],sizeof(char),n,c->client);
>             n-=w;
>             o+=w;
>             if (n) {
>                 alarm(0);
>                 signal(SIGALRM,(void (*)())timeout);
>             }
> }
> --
> 
> So now what's wrong with it?  (Other than the fact that it adds the 
> overhead of a comparison and two function calls in this loop).  Will this 
> fix the timeout problem?  What problems does it introduce?  Like I 
> mentioned in my last post, I haven't looked into this very deeply.
> 
> Nathan
> 
> --
> Nathan Schrenk						nschrenk@neog.com
> Neoglyphics Media Corp.                              http://www.neog.com/
> 
>