From: Alex Rousskov Date: Sun, 28 Sep 2008 01:20:37 +0000 (-0600) Subject: Added pipe cleanup to swanSong, used when we terminate unexpectedly. X-Git-Tag: SQUID_3_1_0_1~45^2~11^2~19 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=506a0530122c1a20db55000499f3f5af2b69866e;p=thirdparty%2Fsquid.git Added pipe cleanup to swanSong, used when we terminate unexpectedly. Polished debugging, added temporary detailed debugging. --- diff --git a/src/eCAP/XactionRep.cc b/src/eCAP/XactionRep.cc index c497d70862..eb4cf0152d 100644 --- a/src/eCAP/XactionRep.cc +++ b/src/eCAP/XactionRep.cc @@ -55,6 +55,20 @@ Ecap::XactionRep::start() void Ecap::XactionRep::swanSong() { + // clear body_pipes, if any + + if (theAnswerRep != NULL) { + BodyPipe::Pointer body_pipe = answer().body_pipe; + if (body_pipe != NULL && body_pipe->stillProducing(this)) + stopProducingFor(body_pipe, false); + } + + { + BodyPipe::Pointer body_pipe = theVirginRep.raw().body_pipe; + if (body_pipe != NULL && body_pipe->stillConsuming(this)) + stopConsumingFrom(body_pipe); + } + terminateMaster(); Adaptation::Initiate::swanSong(); } @@ -327,22 +341,26 @@ const char *Ecap::XactionRep::status() const buf.append(" [", 2); + const BodyPipePointer &vp = theVirginRep.raw().body_pipe; + if (vp != NULL && vp->stillConsuming(this)) { + buf.append("Vb", 2); + buf.append(vp->status(), strlen(vp->status())); // XXX + } + else + buf.append("V.", 2); + if (theAnswerRep != NULL) { MessageRep *answer = dynamic_cast(theAnswerRep.get()); Must(answer); const BodyPipePointer &ap = answer->raw().body_pipe; - if (ap != NULL && ap->stillProducing(this)) - buf.append("Ab ", 3); + if (ap != NULL && ap->stillProducing(this)) { + buf.append(" Ab", 3); + buf.append(ap->status(), strlen(ap->status())); // XXX + } else - buf.append("A. ", 3); + buf.append(" A.", 3); } - const BodyPipePointer &vp = theVirginRep.raw().body_pipe; - if (vp != NULL && vp->stillConsuming(this)) - buf.append("Vb ", 3); - else - buf.append("V. ", 3); - buf.Printf(" ecapx%d]", id); buf.terminate();