--------------------- PatchSet 1594 Date: 2005/08/24 21:07:29 Author: rousskov Branch: squid3-icap Tag: (none) Log: - Do not append more than virgin->data->body buffer can handle. - Set our pipe ends to NULL manually if we are not calling sendAbort/Finish. This way the other side will not call us after we stop(). - Use hasContent() instead of 'contentSize() > 0' Members: src/ICAPAnchor.cc:1.1.2.15->1.1.2.16 Index: squid3/src/ICAPAnchor.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/Attic/ICAPAnchor.cc,v retrieving revision 1.1.2.15 retrieving revision 1.1.2.16 diff -u -r1.1.2.15 -r1.1.2.16 --- squid3/src/ICAPAnchor.cc 24 Aug 2005 20:36:36 -0000 1.1.2.15 +++ squid3/src/ICAPAnchor.cc 24 Aug 2005 21:07:29 -0000 1.1.2.16 @@ -55,7 +55,8 @@ #if MSG_PIPE_USES_MEM_HDR virgin->data->body->write(buf); #else - memBufAppend(virgin->data->body, buf.data, buf.length); + virgin->data->body->append(buf.data, + XMIN(buf.length, (size_t)virgin->data->body->potentialSpaceSize())); #endif virgin->sendSourceProgress(); } @@ -106,7 +107,7 @@ void ICAPAnchor::noteSourceProgress(MsgPipe *p) { debug(93,5)("ICAPAnchor::noteSourceProgress() called\n"); //tell HttpStateData to store a fresh portion of the adapted response - if (p->data->body->contentSize()) { + if (p->data->body->hasContent()) { httpState->takeAdaptedBody(p->data->body); } } @@ -130,12 +131,16 @@ if (virgin) { if (notify == notifyIcap) virgin->sendSourceAbort(); + else + virgin->source = NULL; // this is the place to decrement refcount ptr virgin = NULL; } if (adapted) { if (notify == notifyIcap) adapted->sendSinkAbort(); + else + adapted->sink = NULL; // this is the place to decrement refcount ptr adapted = NULL; }