]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
To keep swanSong() checks simple, we need to NULL-ify vb body_pipe even if
authorAlex Rousskov <rousskov@measurement-factory.com>
Tue, 30 Sep 2008 06:33:34 +0000 (00:33 -0600)
committerAlex Rousskov <rousskov@measurement-factory.com>
Tue, 30 Sep 2008 06:33:34 +0000 (00:33 -0600)
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).

src/eCAP/XactionRep.cc

index 773f9e1dd312979024c112128a0eab752f3b9a78..e7cd344d4188599c38c63f65f675755c6e8d3e00 100644 (file)
@@ -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());
 }