From: Alex Rousskov Date: Tue, 30 Sep 2008 06:33:34 +0000 (-0600) Subject: To keep swanSong() checks simple, we need to NULL-ify vb body_pipe even if X-Git-Tag: SQUID_3_1_0_1~45^2~11^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2874d9e36df1e5be5ca71f0986bae3ab6e2bf285;p=thirdparty%2Fsquid.git To keep swanSong() checks simple, we need to NULL-ify vb body_pipe even if we never were a consumer (because of useVirgin short circuiting). For useVirgin() cloning to work when we were a consumer, we need to clone before we clear the consumer (and body_pipe with it). The whole thing is icky. This should be improved when Adaptation::Message does not have to store a copy of body_pipe (there is already a TODO for that, IIRC). --- diff --git a/src/eCAP/XactionRep.cc b/src/eCAP/XactionRep.cc index 773f9e1dd3..e7cd344d41 100644 --- a/src/eCAP/XactionRep.cc +++ b/src/eCAP/XactionRep.cc @@ -150,6 +150,11 @@ Ecap::XactionRep::useVirgin() proxyingAb = opNever; BodyPipePointer &vbody_pipe = theVirginRep.raw().body_pipe; + + HttpMsg *clone = theVirginRep.raw().header->clone(); + // check that clone() copies the pipe so that we do not have to + Must(!vbody_pipe == !clone->body_pipe); + if (proxyingVb == opOn) { Must(vbody_pipe->stillConsuming(this)); // if libecap consumed, we cannot shortcircuit @@ -158,12 +163,11 @@ Ecap::XactionRep::useVirgin() canAccessVb = false; proxyingVb = opComplete; } else - if (proxyingVb == opUndecided) + if (proxyingVb == opUndecided) { + vbody_pipe = NULL; // it is not our pipe anymore proxyingVb = opNever; + } - HttpMsg *clone = theVirginRep.raw().header->clone(); - // check that clone() copies the pipe so that we do not have to - Must(!theVirginRep.raw().header->body_pipe == !clone->body_pipe); sendAnswer(clone); Must(done()); }