--------------------- PatchSet 455 Date: 2002/12/21 14:09:15 Author: rbcollins Branch: esi Tag: (none) Log: more free behaviour tidyups Members: src/ESI.cc:1.1.2.66->1.1.2.67 Index: squid3/src/ESI.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/ESI.cc,v retrieving revision 1.1.2.66 retrieving revision 1.1.2.67 diff -u -r1.1.2.66 -r1.1.2.67 --- squid3/src/ESI.cc 21 Dec 2002 13:01:45 -0000 1.1.2.66 +++ squid3/src/ESI.cc 21 Dec 2002 14:09:15 -0000 1.1.2.67 @@ -1,6 +1,6 @@ /* - * $Id: ESI.cc,v 1.1.2.66 2002/12/21 13:01:45 rbcollins Exp $ + * $Id: ESI.cc,v 1.1.2.67 2002/12/21 14:09:15 rbcollins Exp $ * * DEBUG: section 86 ESI processing * AUTHOR: Robert Collins @@ -507,6 +507,7 @@ ESIElement::Pointer tree; esiKick_t kick (); + RefCount cbdataLocker; private: CBDATA_CLASS(esiContext); void fail (); @@ -561,13 +562,11 @@ * 1. retry failed upstream requests */ -static FREE esiContextFree; - void * esiContext::operator new(size_t byteCount) { assert (byteCount == sizeof (esiContext)); - CBDATA_INIT_TYPE_FREECB(esiContext, esiContextFree); + CBDATA_INIT_TYPE(esiContext); esiContext *result = cbdataAlloc(esiContext); /* Mark result as being owned - we want the refcounter to do the * delete call @@ -579,25 +578,16 @@ void esiContext::operator delete (void *address) { - /* Do nothing : we've been called via the cbdata freecallback */ -} - -void -esiContext::deleteSelf() const -{ - esiContext *t = const_cast(this); - esiContext *t2 = t; - if (cbdataReferenceValid (t)) - cbdataFree(t); + esiContext *t = static_cast(address); + cbdataFree(t); /* And allow the memory to be freed */ - cbdataReferenceDone (t2); + cbdataReferenceDone (address); } void -esiContextFree (void *base) +esiContext::deleteSelf() const { - esiContext *self = static_cast(base); - delete self; + delete this; } void @@ -954,6 +944,8 @@ context->tree = NULL; /* HACK for parser stack not being emptied */ context->parserState.stack[0] = NULL; + /* allow refcount logic to trigger */ + context->cbdataLocker = NULL; cbdataReferenceDone (context); } @@ -1111,6 +1103,7 @@ esiContext *rv = new esiContext; assert (rep); rv->rep = rep; + rv->cbdataLocker = rv; if (esiAlwaysPassthrough(rep->sline.status)) { rv->flags.passthrough = 1; } else { @@ -2147,6 +2140,10 @@ else ESISegmentFreeList (&temp); } + + /* Depends on full parsing before processing */ + if (processedcount == elementcount) + parent = NULL; debug (86,5)("esiSequence::process: %p completed\n", this); return rv; @@ -2156,6 +2153,7 @@ esiSequence::fail (ESIElement *source) { parent->fail (this); + parent = NULL; } esiSequence::esiSequence(esiSequence const &old)