--------------------- PatchSet 3818 Date: 2006/10/03 04:24:34 Author: rousskov Branch: squid3-icap Tag: (none) Log: - When detecting the end of the virgin data while maintaining Preview-related sizes, it is not enough to know that we have received all virgin data. The Preview EOF condition is satisfied only when we are done both receiving and writing. Renamed sawEof to wroteEof to match the intended semantics a little better and fixed the code computing the parameter. The new name is not perfect because we actually did not write the data chunk at the time of the call, but it matches the rest of the imperfect naming scheme. (Tsantilas Christos ) Members: src/ICAP/ICAPModXact.cc:1.1.2.3->1.1.2.4 src/ICAP/ICAPModXact.h:1.1.2.2->1.1.2.3 Index: squid3/src/ICAP/ICAPModXact.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/ICAP/ICAPModXact.cc,v retrieving revision 1.1.2.3 retrieving revision 1.1.2.4 diff -u -r1.1.2.3 -r1.1.2.4 --- squid3/src/ICAP/ICAPModXact.cc 2 Oct 2006 23:02:18 -0000 1.1.2.3 +++ squid3/src/ICAP/ICAPModXact.cc 3 Oct 2006 04:24:34 -0000 1.1.2.4 @@ -303,8 +303,12 @@ virginConsume(); } - if (state.writing == State::writingPreview) - preview.wrote(chunkSize, state.doneReceiving); // even if wrote nothing + if (state.writing == State::writingPreview) { + // even if we are doneReceiving, we may not have written everything + const bool wroteEof = state.doneReceiving && + claimSize(virginWriteClaim) <= 0; + preview.wrote(chunkSize, wroteEof); // even if wrote nothing + } } void ICAPModXact::addLastRequestChunk(MemBuf &buf) @@ -1278,15 +1282,15 @@ return done() ? 0 : (theAd - theWritten); } -void ICAPPreview::wrote(size_t size, bool sawEof) +void ICAPPreview::wrote(size_t size, bool wroteEof) { Must(enabled()); theWritten += size; if (theWritten >= theAd) - theState = stDone; // sawEof is irrelevant + theState = stDone; // wroteEof is irrelevant else - if (sawEof) + if (wroteEof) theState = stIeof; } Index: squid3/src/ICAP/ICAPModXact.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/ICAP/ICAPModXact.h,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -u -r1.1.2.2 -r1.1.2.3 --- squid3/src/ICAP/ICAPModXact.h 29 Sep 2006 23:27:15 -0000 1.1.2.2 +++ squid3/src/ICAP/ICAPModXact.h 3 Oct 2006 04:24:34 -0000 1.1.2.3 @@ -1,6 +1,6 @@ /* - * $Id: ICAPModXact.h,v 1.1.2.2 2006/09/29 23:27:15 dwsquid Exp $ + * $Id: ICAPModXact.h,v 1.1.2.3 2006/10/03 04:24:34 rousskov Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -110,7 +110,7 @@ bool done() const; // wrote everything bool ieof() const; // premature EOF - void wrote(size_t size, bool sawEof); + void wrote(size_t size, bool wroteEof); private: size_t theWritten;