--------------------- PatchSet 433 Date: 2002/12/20 08:58:00 Author: rbcollins Branch: esi Tag: (none) Log: extract method Members: src/ESI.cc:1.1.2.48->1.1.2.49 Index: squid3/src/ESI.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/ESI.cc,v retrieving revision 1.1.2.48 retrieving revision 1.1.2.49 diff -u -r1.1.2.48 -r1.1.2.49 --- squid3/src/ESI.cc 20 Dec 2002 08:36:10 -0000 1.1.2.48 +++ squid3/src/ESI.cc 20 Dec 2002 08:58:00 -0000 1.1.2.49 @@ -1,6 +1,6 @@ /* - * $Id: ESI.cc,v 1.1.2.48 2002/12/20 08:36:10 rbcollins Exp $ + * $Id: ESI.cc,v 1.1.2.49 2002/12/20 08:58:00 rbcollins Exp $ * * DEBUG: section 86 ESI processing * AUTHOR: Robert Collins @@ -254,6 +254,7 @@ int elementIndex (ESIElement::Pointer anElement) const; bool mayFail_; bool failed; + esiProcessResult_t processOne(int, int); }; MemPool *esiSequence::Pool = NULL; @@ -1983,6 +1984,32 @@ } esiProcessResult_t +esiSequence::processOne(int dovars, int index) +{ + switch (elements[index]->process(dovars)) { + case ESI_PROCESS_COMPLETE: + debug (86,5)("esiSequenceProcess: %p element %p Processed OK\n", + this, elements[index].getRaw()); + if (index == processedcount) + /* another completely ready */ + ++processedcount; + return ESI_PROCESS_COMPLETE; + case ESI_PROCESS_PENDING_WONTFAIL: + debug (86,5)("esiSequenceProcess: element Processed PENDING OK\n"); + return ESI_PROCESS_PENDING_WONTFAIL; + case ESI_PROCESS_PENDING_MAYFAIL: + debug (86,5)("eseSequenceProcess: element Processed PENDING UNKNOWN\n"); + return ESI_PROCESS_PENDING_MAYFAIL; + case ESI_PROCESS_FAILED: + debug (86,5)("esiSequenceProcess: elemen Processed FAILED\n"); + return ESI_PROCESS_FAILED; + default: + fatal ("unexpected code in esiSequence::processOne\n"); + return ESI_PROCESS_FAILED; + } +} + +esiProcessResult_t esiSequence::process (int inheritedVarsFlag) { /* process as much of the list as we can, stopping only on @@ -1994,31 +2021,14 @@ if (flags.dovars) dovars = 1; debug (86,5)("esiSequence::process: Processing %p with%s variable processing\n", this, dovars ? "" : "out"); + for (i = processedcount; i < elementcount; ++i) { debug (86,5)("esiSequence::process %p about to process element[%d] %p\n", this, i, elements[i].getRaw()); - switch (elements[i]->process(dovars)){ - case ESI_PROCESS_COMPLETE: - debug (86,5)("esiSequenceProcess: %p element %p Processed OK\n", - this, elements[i].getRaw()); - if (i == processedcount) - /* another completely ready */ - ++processedcount; - break; - case ESI_PROCESS_PENDING_WONTFAIL: - debug (86,5)("esiSequenceProcess: element Processed PENDING OK\n"); - if (rv < ESI_PROCESS_PENDING_WONTFAIL) - rv = ESI_PROCESS_PENDING_WONTFAIL; - break; - case ESI_PROCESS_PENDING_MAYFAIL: - debug (86,5)("eseSequenceProcess: element Processed PENDING UNKNOWN\n"); - if (rv < ESI_PROCESS_PENDING_MAYFAIL) - rv = ESI_PROCESS_PENDING_MAYFAIL; - break; - case ESI_PROCESS_FAILED: - debug (86,5)("esiSequenceProcess: elemen Processed FAILED\n"); - return ESI_PROCESS_FAILED; - break; - } + esiProcessResult_t tempResult = processOne(dovars, i); + if (rv < tempResult) + rv = tempResult; + if (rv == ESI_PROCESS_FAILED) + return rv; } assert (rv != ESI_PROCESS_COMPLETE || processedcount == elementcount); if (rv == ESI_PROCESS_COMPLETE || rv == ESI_PROCESS_PENDING_WONTFAIL)