#include "ICAPServiceRep.h"
#include "ICAPClient.h"
-#include "LeakFinder.h"
-
-extern LeakFinder *MsgPipeLeaker;
-
CBDATA_CLASS_INIT(ICAPClientReqmodPrecache);
ICAPClientReqmodPrecache::ICAPClientReqmodPrecache(ICAPServiceRep::Pointer aService): service(aService), http(NULL), virgin(NULL), adapted(NULL)
http = cbdataReference(aHttp);
virgin = new MsgPipe("virgin"); // this is the place to create a refcount ptr
- leakTouch(virgin.getRaw(), MsgPipeLeaker);
virgin->source = this;
virgin->data = new MsgPipeData;
virgin->data->cause = NULL;
virgin->data->body->init(ICAP::MsgPipeBufSizeMin, ICAP::MsgPipeBufSizeMax);
adapted = new MsgPipe("adapted");
- leakTouch(adapted.getRaw(), MsgPipeLeaker);
adapted->sink = this;
ICAPInitXaction(service, virgin, adapted);
* than will fit in body MemBuf. Caller should use
* potentialSpaceSize() to find out how much we can hold.
*/
- leakTouch(virgin.getRaw(), MsgPipeLeaker);
virgin->data->body->append(buf.data, buf.length);
virgin->sendSourceProgress();
}
if (virgin == NULL)
return 0;
- leakTouch(virgin.getRaw(), MsgPipeLeaker);
-
return (int) virgin->data->body->potentialSpaceSize();
}
void ICAPClientReqmodPrecache::doneSending()
{
debug(93,3)("ICAPClientReqmodPrecache::doneSending() called\n");
- leakTouch(virgin.getRaw(), MsgPipeLeaker);
virgin->sendSourceFinish();
}
{
debug(93,3)("ICAPClientReqmodPrecache::noteSinkNeed() called\n");
- leakTouch(virgin.getRaw(), MsgPipeLeaker);
-
if (virgin->data->body->potentialSpaceSize())
http->icapSpaceAvailable();
}
void ICAPClientReqmodPrecache::noteSourceStart(MsgPipe *p)
{
debug(93,3)("ICAPClientReqmodPrecache::noteSourceStart() called\n");
- leakTouch(adapted.getRaw(), MsgPipeLeaker);
http->takeAdaptedHeaders(adapted->data->header);
noteSourceProgress(p);
}
debug(93,3)("ICAPClientReqmodPrecache::noteSourceProgress() called\n");
//tell ClientHttpRequest to store a fresh portion of the adapted response
- leakTouch(p, MsgPipeLeaker);
-
if (p->data->body->hasContent()) {
http->takeAdaptedBody(p->data->body);
}
{
debug(93,3)("ICAPClientReqmodPrecache::noteSourceFinish() called\n");
//tell ClientHttpRequest that we expect no more response data
- leakTouch(p, MsgPipeLeaker);
http->doneAdapting();
stop(notifyNone);
}
void ICAPClientReqmodPrecache::noteSourceAbort(MsgPipe *p)
{
debug(93,3)("ICAPClientReqmodPrecache::noteSourceAbort() called\n");
- leakTouch(p, MsgPipeLeaker);
stop(notifyOwner);
}
void ICAPClientReqmodPrecache::stop(Notify notify)
{
if (virgin != NULL) {
- leakTouch(virgin.getRaw(), MsgPipeLeaker);
-
if (notify == notifyIcap)
virgin->sendSourceAbort();
else
}
if (adapted != NULL) {
- leakTouch(adapted.getRaw(), MsgPipeLeaker);
-
if (notify == notifyIcap)
adapted->sendSinkAbort();
else
// virgin->data->cause should be NULL;
requestUnlink(dynamic_cast<HttpRequest*>(virgin->data->header));
virgin->data->header = NULL;
- leakTouch(virgin.getRaw(), MsgPipeLeaker);
virgin = NULL; // refcounted
}
void ICAPClientReqmodPrecache::freeAdapted()
{
adapted->data->header = NULL; // we don't own it
- leakTouch(adapted.getRaw(), MsgPipeLeaker);
adapted = NULL; // refcounted
}
#include "ICAPClient.h"
#include "ICAPServiceRep.h"
-#include "LeakFinder.h"
-
CBDATA_CLASS_INIT(ICAPClientRespmodPrecache);
-extern LeakFinder *MsgPipeLeaker;
-
ICAPClientRespmodPrecache::ICAPClientRespmodPrecache(ICAPServiceRep::Pointer aService): service(aService), httpState(NULL), virgin(NULL), adapted(NULL)
{
debug(93,5)("ICAPClientRespmodPrecache constructed, this=%p\n", this);
httpState = cbdataReference(anHttpState);
virgin = new MsgPipe("virgin"); // this is the place to create a refcount ptr
- leakTouch(virgin.getRaw(), MsgPipeLeaker);
virgin->source = this;
virgin->data = new MsgPipeData;
virgin->data->cause = requestLink(request);
virgin->data->body->init(ICAP::MsgPipeBufSizeMin, ICAP::MsgPipeBufSizeMax);
adapted = new MsgPipe("adapted");
- leakTouch(adapted.getRaw(), MsgPipeLeaker);
adapted->sink = this;
#if ICAP_ANCHOR_LOOPBACK
* than will fit in body MemBuf. Caller should use
* potentialSpaceSize() to find out how much we can hold.
*/
- leakTouch(virgin.getRaw(), MsgPipeLeaker);
virgin->data->body->append(buf.data, buf.length);
virgin->sendSourceProgress();
}
if (virgin == NULL)
return 0;
- leakTouch(virgin.getRaw(), MsgPipeLeaker);
-
return (int) virgin->data->body->potentialSpaceSize();
}
return;
#else
- leakTouch(virgin.getRaw(), MsgPipeLeaker);
virgin->sendSourceFinish();
#endif
}
{
debug(93,5)("ICAPClientRespmodPrecache::noteSinkNeed() called\n");
- leakTouch(virgin.getRaw(), MsgPipeLeaker);
-
if (virgin->data->body->potentialSpaceSize())
httpState->icapSpaceAvailable();
}
void ICAPClientRespmodPrecache::noteSourceStart(MsgPipe *p)
{
debug(93,5)("ICAPClientRespmodPrecache::noteSourceStart() called\n");
- leakTouch(adapted.getRaw(), MsgPipeLeaker);
HttpReply *reply = dynamic_cast<HttpReply*>(adapted->data->header);
assert(reply); // check that ICAP xaction created the right object
debug(93,5)("ICAPClientRespmodPrecache::noteSourceProgress() called\n");
//tell HttpStateData to store a fresh portion of the adapted response
- leakTouch(p, MsgPipeLeaker);
-
if (p->data->body->hasContent()) {
httpState->takeAdaptedBody(p->data->body);
}
{
debug(93,5)("ICAPClientRespmodPrecache::noteSourceFinish() called\n");
//tell HttpStateData that we expect no more response data
- leakTouch(p, MsgPipeLeaker);
httpState->doneAdapting();
stop(notifyNone);
}
void ICAPClientRespmodPrecache::noteSourceAbort(MsgPipe *p)
{
debug(93,5)("ICAPClientRespmodPrecache::noteSourceAbort() called\n");
- leakTouch(p, MsgPipeLeaker);
stop(notifyOwner);
}
void ICAPClientRespmodPrecache::stop(Notify notify)
{
if (virgin != NULL) {
- leakTouch(virgin.getRaw(), MsgPipeLeaker);
-
if (notify == notifyIcap)
virgin->sendSourceAbort();
else
}
if (adapted != NULL) {
- leakTouch(adapted.getRaw(), MsgPipeLeaker);
-
if (notify == notifyIcap)
adapted->sendSinkAbort();
else
requestUnlink(virgin->data->cause);
virgin->data->cause = NULL;
virgin->data->header = NULL;
- leakTouch(virgin.getRaw(), MsgPipeLeaker);
virgin = NULL; // refcounted
}
adapted->data->header = NULL;
}
- leakTouch(adapted.getRaw(), MsgPipeLeaker);
adapted = NULL; // refcounted
}
#include "MsgPipeSink.h"
#include "MsgPipeData.h"
-#include "LeakFinder.h"
-LeakFinder *MsgPipeLeaker = new LeakFinder;
-
CBDATA_CLASS_INIT(MsgPipe);
// static event callback template
MsgPipe::MsgPipe(const char *aName): name(aName),
data(NULL), source(NULL), sink(NULL)
-{
- leakAdd(this, MsgPipeLeaker);
-}
+{}
MsgPipe::~MsgPipe()
{
delete data;
delete source;
delete sink;
- leakFree(this, MsgPipeLeaker);
};
void MsgPipe::sendSourceStart()
{
- leakTouch(this, MsgPipeLeaker);
debug(99,5)("MsgPipe::sendSourceStart() called\n");
sendLater("SourceStart", &MsgPipe_sendSourceStart, sink);
}
void MsgPipe::sendSourceProgress()
{
- leakTouch(this, MsgPipeLeaker);
debug(99,5)("MsgPipe::sendSourceProgress() called\n");
sendLater("SourceProgress", &MsgPipe_sendSourceProgress, sink);
}
void MsgPipe::sendSourceFinish()
{
- leakTouch(this, MsgPipeLeaker);
debug(99,5)("MsgPipe::sendSourceFinish() called\n");
sendLater("sendSourceFinish", &MsgPipe_sendSourceFinish, sink);
source = NULL;
void MsgPipe::sendSourceAbort()
{
- leakTouch(this, MsgPipeLeaker);
debug(99,5)("MsgPipe::sendSourceAbort() called\n");
sendLater("SourceAbort", &MsgPipe_sendSourceAbort, sink);
source = NULL;
void MsgPipe::sendSinkNeed()
{
- leakTouch(this, MsgPipeLeaker);
debug(99,5)("MsgPipe::sendSinkNeed() called\n");
sendLater("SinkNeed", &MsgPipe_sendSinkNeed, source);
}
void MsgPipe::sendSinkAbort()
{
- leakTouch(this, MsgPipeLeaker);
debug(99,5)("MsgPipe::sendSinkAbort() called\n");
sendLater("SinkAbort", &MsgPipe_sendSinkAbort, source);
sink = NULL;
void MsgPipe::sendLater(const char *callName, EVH * handler, MsgPipeEnd *destination)
{
- leakTouch(this, MsgPipeLeaker);
-
if (canSend(destination, callName, true))
eventAdd(callName, handler, this, 0.0, 0, true);
}
bool MsgPipe::canSend(MsgPipeEnd *destination, const char *callName, bool future)
{
- leakTouch(this, MsgPipeLeaker);
const bool res = destination != NULL;
const char *verb = future ?
(res ? "will send " : "wont send ") :