httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Juan Rivera <Juan.Riv...@citrix.com>
Subject RE: [PATCH] Avoid unnecessary brigade splits on core input and ou tput filters. WAS: EOS or FLUSH buckets
Date Thu, 12 Jun 2003 21:26:56 GMT
My bad, never mind. You are fixing up the ctx->b pointers. I'm going to try
it out.
 
-----Original Message-----
From: Juan Rivera [mailto:Juan.Rivera@citrix.com] 
Sent: Thursday, June 12, 2003 5:25 PM
To: 'dev@httpd.apache.org'
Subject: RE: [PATCH] Avoid unnecessary brigade splits on core input and ou
tput filters. WAS: EOS or FLUSH buckets
 
Cliff, 
Is your code assuming that b is empty? If so, I'm not sure we can make that
assumption. 
-----Original Message----- 
From: Cliff Woolley [mailto:jwoolley@virginia.edu
<mailto:jwoolley@virginia.edu> ] 
Sent: Thursday, June 12, 2003 5:08 PM 
To: dev@httpd.apache.org 
Subject: Re: [PATCH] Avoid unnecessary brigade splits on core input and
output filters. WAS: EOS or FLUSH buckets 
On Thu, 12 Jun 2003, Justin Erenkrantz wrote: 
> for (bucket = APR_BUCKET_FIRST(ctx->b); 
>      bucket != e && bucket != APR_BRIGADE_LAST(ctx->b); 
>      bucket = APR_BUCKET_NEXT(bucket)) { 
>    apr_bucket_remove(bucket); 
>    APR_BRIGADE_INSERT_TAIL(b, bucket); 
> } 
No!  Bad!!  The whole beauty of the ring data structure is that all of 
these operations can be done in constant time, no loops.  Bear with me, 
and I'll explain. 
 
> If you understand the type safety checks it is attempting, you are a far 
> more intelligent person than I.  =) 
Well, I dunno about that... I do understand them but then again I've 
focused on them since literally the day I started contributing to this lil 
ole web server. 
 
The following code assumes that ctx->b has at least one bucket in it, 
namely e. 
 
if (APR_BRIGADE_FIRST(ctx->b) != e) 
{ 
    /* move the sequence into the new brigade */ 
    APR_RING_SPLICE_TAIL(&b->list, 
                         APR_BRIGADE_FIRST(ctx->b), 
                         APR_BUCKET_PREV(e), 
                         apr_bucket, link); 
    /* fixup the dangling pointers in ctx->b */ 
    APR_BRIGADE_FIRST(ctx->b) = e; 
    APR_BUCKET_PREV(e) = APR_BRIGADE_SENTINEL(ctx->b); 
} 
Lovely, eh?  I didn't actually test this to make sure it's 100% right, but 
conceptually I believe it should do the trick. 
--Cliff 

Mime
View raw message