]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/adaptation/Service.cc
730035db8da53017cbfb10d00e3ddf4c855d52ba
2 * DEBUG: section 93 Adaptation
6 #include "HttpRequest.h"
7 #include "adaptation/ServiceFilter.h"
8 #include "adaptation/Service.h"
10 Adaptation::Service::Service(const ServiceConfigPointer
&aConfig
): theConfig(aConfig
)
12 Must(theConfig
!= NULL
);
13 debugs(93,3, HERE
<< "creating adaptation service " << cfg().key
);
16 Adaptation::Service::~Service()
20 Adaptation::Service::finalize()
24 bool Adaptation::Service::broken() const
26 return probed() && !up();
30 Adaptation::Service::wants(const ServiceFilter
&filter
) const
32 if (cfg().method
!= filter
.method
)
35 if (cfg().point
!= filter
.point
)
38 // sending a message to a broken service is likely to cause errors
39 if (cfg().bypass
&& broken())
43 // Sending a message to a service that does not want it is useless.
44 // note that we cannot check wantsUrl for service that is not "up"
45 // note that even essential services are skipped on unwanted URLs!
46 return wantsUrl(filter
.request
->urlpath
);
49 // The service is down and is either not bypassable or not probed due
50 // to the bypass && broken() test above. Thus, we want to use it!
54 Adaptation::Services
&
55 Adaptation::AllServices()
57 static Services TheServices
;
61 Adaptation::ServicePointer
62 Adaptation::FindService(const Service::Id
& key
)
64 typedef Services::iterator SI
;
65 for (SI i
= AllServices().begin(); i
!= AllServices().end(); ++i
) {
66 if ((*i
)->cfg().key
== key
)
72 void Adaptation::DetachServices()
74 while (!AllServices().empty())
75 AllServices().pop_back()->detach();