]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/adaptation/Service.cc
2 * DEBUG: section 93 Adaptation
6 #include "HttpRequest.h"
7 #include "adaptation/ServiceFilter.h"
8 #include "adaptation/Service.h"
10 Adaptation::Service::Service(const ServiceConfig
&aConfig
): theConfig(aConfig
)
12 debugs(93,3, HERE
<< "creating adaptation service " << theConfig
.key
);
15 Adaptation::Service::~Service()
19 Adaptation::Service::finalize()
23 bool Adaptation::Service::broken() const
25 return probed() && !up();
29 Adaptation::Service::wants(const ServiceFilter
&filter
) const
31 if (cfg().method
!= filter
.method
)
34 if (cfg().point
!= filter
.point
)
37 // sending a message to a broken service is likely to cause errors
38 if (cfg().bypass
&& broken())
42 // Sending a message to a service that does not want it is useless.
43 // note that we cannot check wantsUrl for service that is not "up"
44 // note that even essential services are skipped on unwanted URLs!
45 return wantsUrl(filter
.request
->urlpath
);
48 // The service is down and is either not bypassable or not probed due
49 // 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();