]> git.ipfire.org Git - thirdparty/squid.git/blob - src/adaptation/ServiceFilter.cc
Merged from trunk (r13356).
[thirdparty/squid.git] / src / adaptation / ServiceFilter.cc
1 #include "squid.h"
2 #include "AccessLogEntry.h"
3 #include "adaptation/ServiceFilter.h"
4 #include "HttpReply.h"
5 #include "HttpRequest.h"
6
7 Adaptation::ServiceFilter::ServiceFilter(Method aMethod, VectPoint aPoint, HttpRequest *aReq, HttpReply *aRep, AccessLogEntry::Pointer const &alp):
8 method(aMethod),
9 point(aPoint),
10 request(aReq),
11 reply(aRep),
12 al(alp)
13 {
14 if (reply)
15 HTTPMSGLOCK(reply);
16
17 // a lot of code assumes that there is always a virgin request or cause
18 assert(request);
19 HTTPMSGLOCK(request);
20 }
21
22 Adaptation::ServiceFilter::ServiceFilter(const ServiceFilter &f):
23 method(f.method),
24 point(f.point),
25 request(f.request),
26 reply(f.reply),
27 al(f.al)
28 {
29 if (request)
30 HTTPMSGLOCK(request);
31
32 if (reply)
33 HTTPMSGLOCK(reply);
34 }
35
36 Adaptation::ServiceFilter::~ServiceFilter()
37 {
38 HTTPMSGUNLOCK(request);
39 HTTPMSGUNLOCK(reply);
40 }
41
42 Adaptation::ServiceFilter &Adaptation::ServiceFilter::operator =(const ServiceFilter &f)
43 {
44 if (this != &f) {
45 method = f.method;
46 point = f.point;
47 HTTPMSGUNLOCK(request);
48 HTTPMSGUNLOCK(reply);
49 request = f.request;
50 HTTPMSGLOCK(request);
51 reply = f.reply;
52 if (reply)
53 HTTPMSGLOCK(reply);
54 }
55 return *this;
56 }