ICAPServiceRep::ICAPServiceRep(): method(ICAP::methodNone),
point(ICAP::pointNone), port(-1), bypass(false),
- theOptions(NULL), theLastUpdate(0),
- theSessionFailures(0), isSuspended(0),
- waiting(false), notifying(false),
+ theOptions(NULL), theOptionsFetcher(0), theLastUpdate(0),
+ theSessionFailures(0), isSuspended(0), notifying(false),
updateScheduled(false), self(NULL),
wasAnnouncedUp(true) // do not announce an "up" service at startup
{}
ICAPServiceRep::~ICAPServiceRep()
{
- Must(!waiting);
+ Must(!theOptionsFetcher);
changeOptions(0);
}
if (self != NULL)
updateScheduled = false;
- if (!self || waiting) {
+ if (!self || theOptionsFetcher) {
debugs(93,5, "ICAPService ignores options update " << status());
return;
}
i.data = cbdataReference(data);
theClients.push_back(i);
- if (waiting || notifying)
+ if (theOptionsFetcher || notifying)
return; // do nothing, we will be picked up in noteTimeToNotify()
if (needNewOptions())
// we are receiving ICAP OPTIONS response headers here or NULL on failures
void ICAPServiceRep::noteIcapAnswer(HttpMsg *msg)
{
- Must(waiting);
- waiting = false;
+ Must(theOptionsFetcher);
+ clearIcap(theOptionsFetcher);
Must(msg);
}
void ICAPServiceRep::noteIcapQueryAbort(bool) {
- Must(waiting);
- waiting = false;
+ Must(theOptionsFetcher);
+ clearIcap(theOptionsFetcher);
debugs(93,3, "ICAPService failed to fetch options " << status());
handleNewOptions(0);
void ICAPServiceRep::startGettingOptions()
{
- Must(!waiting);
+ Must(!theOptionsFetcher);
debugs(93,6, "ICAPService will get new options " << status());
- waiting = true;
- initiateIcap(new ICAPOptXactLauncher(this, self));
+ theOptionsFetcher = initiateIcap(new ICAPOptXactLauncher(this, self));
// TODO: timeout in case ICAPOptXact never calls us back?
// Such a timeout should probably be a generic AsyncStart feature.
}
buf.append(",stale", 6);
}
- if (waiting)
- buf.append(",wait", 5);
+ if (theOptionsFetcher)
+ buf.append(",fetch", 6);
if (notifying)
buf.append(",notif", 6);
/*
- * $Id: ICAPServiceRep.h,v 1.10 2007/06/19 21:13:49 rousskov Exp $
+ * $Id: ICAPServiceRep.h,v 1.11 2007/07/24 16:43:33 rousskov Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
Clients theClients; // all clients waiting for a call back
ICAPOptions *theOptions;
+ ICAPInitiate *theOptionsFetcher; // pending ICAP OPTIONS transaction
time_t theLastUpdate; // time the options were last updated
static const int TheSessionFailureLimit;
int theSessionFailures;
const char *isSuspended; // also stores suspension reason for debugging
- bool waiting; // for an OPTIONS transaction to finish
bool notifying; // may be true in any state except for the initial
bool updateScheduled; // time-based options update has been scheduled