]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Made eCAP compile again after CbcPointer<> changes.
authorAlex Rousskov <rousskov@measurement-factory.com>
Sun, 29 Aug 2010 21:50:09 +0000 (15:50 -0600)
committerAlex Rousskov <rousskov@measurement-factory.com>
Sun, 29 Aug 2010 21:50:09 +0000 (15:50 -0600)
Old eCAP code tried to call stillProducing(this) and stillConsuming(this)
methods from a const status() method. Doing so produces compiler errors
because stillProducing() and stillConsuming() do not accept pointers to
constant jobs.

CBDATA_CLASSes and, hence, CbcPointer<>, do not support const-correctness
well: In order to create/destroy a cbdata-based smart pointer, one has to
lock/unlock cbdata, which requires modifying the object. Thus, the smart
pointer cannot point to a truly constant object. The core of the problem is
that CBDATA_CLASSes keep cbdata and object data together. When all raw/dumb
CBDATA_CLASS pointers are gone, we can separate the two "datas" and solve the
const-correctness problem for good. The "separate-datas" design would even be
consistent with the original cbdata design which we often violate, IMO.

There are other workarounds. We could declare toCbdata() constant, for
example. However, that would essentially disable checks where a
cbdata-protected object is being destroyed despite the caller's intent to keep
the object constant. This change is not as general but is also much less
intrusive.

src/adaptation/ecap/XactionRep.cc

index 462dc160edffaf013d35302a1cad0109883fc228..8a0251733627568571cd1c7497e0764299b96a77 100644 (file)
@@ -430,9 +430,8 @@ Adaptation::Ecap::XactionRep::status() const
         const BodyPipePointer &vp = theVirginRep.raw().body_pipe;
         if (!canAccessVb)
             buf.append("x", 1);
-        if (vp != NULL && vp->stillConsuming(this)) {
+        if (vp != NULL) { // XXX: but may not be stillConsuming()
             buf.append("Vb", 2);
-            buf.append(vp->status(), strlen(vp->status())); // XXX
         } else
             buf.append("V.", 2);
     }
@@ -441,9 +440,8 @@ Adaptation::Ecap::XactionRep::status() const
         MessageRep *rep = dynamic_cast<MessageRep*>(theAnswerRep.get());
         Must(rep);
         const BodyPipePointer &ap = rep->raw().body_pipe;
-        if (ap != NULL && ap->stillProducing(this)) {
+        if (ap != NULL) { // XXX: but may not be stillProducing()
             buf.append(" Ab", 3);
-            buf.append(ap->status(), strlen(ap->status())); // XXX
         } else
             buf.append(" A.", 3);
     }