--------------------- PatchSet 5080 Date: 2007/07/18 23:24:26 Author: hno Branch: bug1921 Tag: (none) Log: Wait for the response buffer to drain when protocol signals it's completed also remove the unused flowcontrol hooks. Wasn't needed afterall. Members: src/Server.cc:1.12.2.2->1.12.2.3 src/Server.h:1.5.2.1->1.5.2.2 src/ftp.cc:1.78.2.2->1.78.2.3 src/http.cc:1.115.2.1->1.115.2.2 src/http.h:1.25.2.1->1.25.2.2 Index: squid3/src/Server.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/Server.cc,v retrieving revision 1.12.2.2 retrieving revision 1.12.2.3 diff -u -r1.12.2.2 -r1.12.2.3 --- squid3/src/Server.cc 18 Jul 2007 23:08:35 -0000 1.12.2.2 +++ squid3/src/Server.cc 18 Jul 2007 23:24:26 -0000 1.12.2.3 @@ -1,5 +1,5 @@ /* - * $Id: Server.cc,v 1.12.2.2 2007/07/18 23:08:35 hno Exp $ + * $Id: Server.cc,v 1.12.2.3 2007/07/18 23:24:26 hno Exp $ * * DEBUG: * AUTHOR: Duane Wessels @@ -91,9 +91,22 @@ assert(doneWithServer()); } + completed = true; + if (requestBodySource != NULL) stopConsumingFrom(requestBodySource); + if (responseBodyBuffer != NULL) + return; + + serverComplete2(); +} + +void +ServerStateData::serverComplete2() +{ + debugs(11,5,HERE << "serverComplete2 " << this); + #if ICAP_CLIENT if (virginBodyDestination != NULL) stopProducingFor(virginBodyDestination, true); @@ -372,6 +385,10 @@ { if (responseBodyBuffer) { addReplyBody(NULL, 0); // Hack to kick the buffered fragment alive again + if (completed && !responseBodyBuffer) { + serverComplete2(); + return; + } } maybeReadVirginBody(); } Index: squid3/src/Server.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/Server.h,v retrieving revision 1.5.2.1 retrieving revision 1.5.2.2 diff -u -r1.5.2.1 -r1.5.2.2 --- squid3/src/Server.h 18 Jul 2007 10:21:18 -0000 1.5.2.1 +++ squid3/src/Server.h 18 Jul 2007 23:24:26 -0000 1.5.2.2 @@ -1,6 +1,6 @@ /* - * $Id: Server.h,v 1.5.2.1 2007/07/18 10:21:18 hno Exp $ + * $Id: Server.h,v 1.5.2.2 2007/07/18 23:24:26 hno Exp $ * * AUTHOR: Duane Wessels * @@ -105,6 +105,10 @@ public: // should be protected void serverComplete(); // call when no server communication is expected +private: + void serverComplete2(); // Continuation of serverComplete + bool completed; // serverComplete() has been called + protected: // kids customize these virtual void haveParsedReplyHeaders(); // default does nothing @@ -148,10 +152,6 @@ void addReplyBody(const char *buf, ssize_t len); size_t replyBodySpace(size_t space = 4096 * 10); - // And kids must customize these for flow control - virtual void pauseReceiver() = 0; - virtual void resumeReceiver() = 0; - // These should be private off_t currentOffset; // Our current offset in the StoreEntry MemBuf *responseBodyBuffer; // Data temporarily buffered for ICAP Index: squid3/src/ftp.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/ftp.cc,v retrieving revision 1.78.2.2 retrieving revision 1.78.2.3 diff -u -r1.78.2.2 -r1.78.2.3 --- squid3/src/ftp.cc 18 Jul 2007 23:09:14 -0000 1.78.2.2 +++ squid3/src/ftp.cc 18 Jul 2007 23:24:26 -0000 1.78.2.3 @@ -1,6 +1,6 @@ /* - * $Id: ftp.cc,v 1.78.2.2 2007/07/18 23:09:14 hno Exp $ + * $Id: ftp.cc,v 1.78.2.3 2007/07/18 23:24:26 hno Exp $ * * DEBUG: section 9 File Transfer Protocol (FTP) * AUTHOR: Harvest Derived @@ -224,10 +224,6 @@ private: // BodyConsumer for HTTP: consume request body. virtual void handleRequestBodyProducerAborted(); - -protected: - virtual void pauseReceiver(); - virtual void resumeReceiver(); }; CBDATA_CLASS_INIT(FtpStateData); @@ -3355,14 +3351,3 @@ fwd->handleUnregisteredServerEnd(); delete this; } - -void -FtpStateData::pauseReceiver() -{ -} - -void -FtpStateData::resumeReceiver() -{ -} - Index: squid3/src/http.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/http.cc,v retrieving revision 1.115.2.1 retrieving revision 1.115.2.2 diff -u -r1.115.2.1 -r1.115.2.2 --- squid3/src/http.cc 18 Jul 2007 10:21:19 -0000 1.115.2.1 +++ squid3/src/http.cc 18 Jul 2007 23:24:26 -0000 1.115.2.2 @@ -1,6 +1,6 @@ /* - * $Id: http.cc,v 1.115.2.1 2007/07/18 10:21:19 hno Exp $ + * $Id: http.cc,v 1.115.2.2 2007/07/18 23:24:26 hno Exp $ * * DEBUG: section 11 Hypertext Transfer Protocol (HTTP) * AUTHOR: Harvest Derived @@ -1883,14 +1883,3 @@ { return orig_request; } - -void -HttpStateData::pauseReceiver() -{ -} - -void -HttpStateData::resumeReceiver() -{ -} - Index: squid3/src/http.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/http.h,v retrieving revision 1.25.2.1 retrieving revision 1.25.2.2 diff -u -r1.25.2.1 -r1.25.2.2 --- squid3/src/http.h 18 Jul 2007 10:21:20 -0000 1.25.2.1 +++ squid3/src/http.h 18 Jul 2007 23:24:26 -0000 1.25.2.2 @@ -1,6 +1,6 @@ /* - * $Id: http.h,v 1.25.2.1 2007/07/18 10:21:20 hno Exp $ + * $Id: http.h,v 1.25.2.2 2007/07/18 23:24:26 hno Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -39,12 +39,6 @@ #include "forward.h" #include "Server.h" -#if ICAP_CLIENT -#include "ICAP/ICAPServiceRep.h" - -class ICAPAccessCheck; -#endif - class HttpStateData : public ServerStateData { @@ -90,11 +84,7 @@ const HttpReply * getReply() const { assert(reply); return reply; } protected: -#if ICAP_CLIENT virtual HttpRequest *originalRequest(); -#endif - virtual void pauseReceiver(); - virtual void resumeReceiver(); private: enum ConnectionStatus { @@ -128,9 +118,6 @@ http_state_flags flags); static bool decideIfWeDoRanges (HttpRequest * orig_request); -#if ICAP_CLIENT -#endif - private: CBDATA_CLASS2(HttpStateData); };