--------------------- PatchSet 1956 Date: 2005/10/17 23:15:49 Author: rousskov Branch: squid3-icap Tag: (none) Log: - Use ICAP::* types and constants from ICAPElements instead of ICAPServiceRep::* and globals. - Supply ICAPServiceRep::Pointer to ICAPServiceRep so that it can use it to initiate options-updating transactions (ICAPOptXact). When destroying the config, invalidate ICAPServiceReps so that they are deleted when no longer in use by others. - Polished services iteration loop in dumpICAPService(). Members: src/ICAPConfig.cc:1.1.2.9->1.1.2.10 Index: squid3/src/ICAPConfig.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/Attic/ICAPConfig.cc,v retrieving revision 1.1.2.9 retrieving revision 1.1.2.10 diff -u -r1.1.2.9 -r1.1.2.10 --- squid3/src/ICAPConfig.cc 3 Oct 2005 23:28:43 -0000 1.1.2.9 +++ squid3/src/ICAPConfig.cc 17 Oct 2005 23:15:49 -0000 1.1.2.10 @@ -1,6 +1,6 @@ /* - * $Id: ICAPConfig.cc,v 1.1.2.9 2005/10/03 23:28:43 dwsquid Exp $ + * $Id: ICAPConfig.cc,v 1.1.2.10 2005/10/17 23:15:49 rousskov Exp $ * * SQUID Web Proxy Cache http://www.squid-cache.org/ * ---------------------------------------------------------- @@ -111,8 +111,8 @@ CBDATA_CLASS_INIT(ICAPAccessCheck); -ICAPAccessCheck::ICAPAccessCheck(ICAPServiceRep::IcapMethod aMethod, - ICAPServiceRep::IcapVectPoint aPoint, +ICAPAccessCheck::ICAPAccessCheck(ICAP::Method aMethod, + ICAP::VectPoint aPoint, HttpRequest *aReq, HttpReply *aRep, ICAPAccessCheckCallback *aCallback, @@ -185,15 +185,12 @@ void ICAPConfig::parseICAPService() { - ICAPServiceRep *S = new ICAPServiceRep(); + ICAPServiceRep::Pointer S = new ICAPServiceRep(); - if (S->parseConfigLine()) { + if (S->configure(S)) services += S; - } else { - delete S; - } - - return; + else + S->invalidate(); }; void @@ -205,12 +202,12 @@ void ICAPConfig::dumpICAPService(StoreEntry *entry, const char *name) { - Vector::iterator i = services.begin(); + typedef Vector::iterator VI; - while (i != services.end()) { - ICAPServiceRep *r = i->getRaw(); - storeAppendPrintf(entry, "%s %s_%s %s %d %s\n", name, r->key.buf(), r->methodStr(), r->vectPointStr(), r->bypass, r->uri.buf()); - ++i; + for (VI i = services.begin(); i != services.end(); ++i) { + const ICAPServiceRep::Pointer &r = *i; + storeAppendPrintf(entry, "%s %s_%s %s %d %s\n", name, r->key.buf(), + r->methodStr(), r->vectPointStr(), r->bypass, r->uri.buf()); } }; @@ -301,6 +298,12 @@ ICAPConfig::~ICAPConfig() { delete classes; - services.clean(); + + // invalidate each service so that it can be deleted when refcount=0 + typedef Vector::iterator VI; + + for (VI i = services.begin(); i != services.end(); ++i) + (*i)->invalidate(); + delete accesses; };