--------------------- PatchSet 4772 Date: 2002/08/25 02:46:07 Author: rbcollins Branch: esi Tag: (none) Log: recursive includes bugfix Members: src/ESI.c:1.1.2.22->1.1.2.23 Index: squid/src/ESI.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/Attic/ESI.c,v retrieving revision 1.1.2.22 retrieving revision 1.1.2.23 diff -u -r1.1.2.22 -r1.1.2.23 --- squid/src/ESI.c 25 Aug 2002 00:42:00 -0000 1.1.2.22 +++ squid/src/ESI.c 25 Aug 2002 02:46:07 -0000 1.1.2.23 @@ -1,6 +1,6 @@ /* - * $Id: ESI.c,v 1.1.2.22 2002/08/25 00:42:00 rbcollins Exp $ + * $Id: ESI.c,v 1.1.2.23 2002/08/25 02:46:07 rbcollins Exp $ * * DEBUG: section 86 ESI processing * AUTHOR: Robert Collins @@ -403,10 +403,12 @@ esiKick (esiContext *context) { assert (context); - if (context->flags.kicked) - return ESI_KICK_PENDING; + if (context->flags.kicked) { + debug (86,5)("esiKick: Re-entered whilst in progress\n"); +// return ESI_KICK_PENDING; + } else - context->flags.kicked = 1; + ++context->flags.kicked; /* Something has occured. Process any remaining nodes */ if (!context->flags.finished) /* Process some of our data */ @@ -424,7 +426,7 @@ */ if (context->pos == 0) esiFail (context->this, context, context->http); - context->flags.kicked = 0; + --context->flags.kicked; return ESI_KICK_FAILED; } @@ -441,11 +443,11 @@ /* Is there data to send? */ if (esiSend (context->this, context, context->http)) { /* some data was sent. we're finished until the next read */ - context->flags.kicked = 0; + --context->flags.kicked; return ESI_KICK_SENT; } - context->flags.kicked = 0; + --context->flags.kicked; /* nothing to send */ return ESI_KICK_PENDING; } @@ -601,6 +603,7 @@ /* TODO: skip data until pos == next->readoff; */ clientStreamNode *next = this->node.next->data; size_t len = 0; + HttpReply *rep; cbdataReference (context); if (context->outbound) len = next->readlen < (context->outbound->len - context->outbound_offset) ? @@ -630,11 +633,12 @@ } context->flags.clientwantsdata = 0; debug (86,5)("esiSend: Client no longer wants data \n"); - clientStreamCallback (this, http, context->rep, next->readbuf, len); + /* Deal with re-entrancy */ + rep = context->rep; + context->rep = NULL; /* freed downstream */ + clientStreamCallback (this, http, rep, next->readbuf, len); if (len == 0) len = -1; /* tell the caller we sent something */ - if (context->rep) - context->rep = NULL; /* freed downstream */ cbdataReferenceDone (context); debug (86,5)("esiSend returning %d\n",len); return len;