]> git.ipfire.org Git - thirdparty/squid.git/blob - src/adaptation/ServiceFilter.cc
SourceFormat Enforcement
[thirdparty/squid.git] / src / adaptation / ServiceFilter.cc
1 /*
2 * Copyright (C) 1996-2015 The Squid Software Foundation and contributors
3 *
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
7 */
8
9 #include "squid.h"
10 #include "AccessLogEntry.h"
11 #include "adaptation/ServiceFilter.h"
12 #include "HttpReply.h"
13 #include "HttpRequest.h"
14
15 Adaptation::ServiceFilter::ServiceFilter(Method aMethod, VectPoint aPoint, HttpRequest *aReq, HttpReply *aRep, AccessLogEntry::Pointer const &alp):
16 method(aMethod),
17 point(aPoint),
18 request(aReq),
19 reply(aRep),
20 al(alp)
21 {
22 if (reply)
23 HTTPMSGLOCK(reply);
24
25 // a lot of code assumes that there is always a virgin request or cause
26 assert(request);
27 HTTPMSGLOCK(request);
28 }
29
30 Adaptation::ServiceFilter::ServiceFilter(const ServiceFilter &f):
31 method(f.method),
32 point(f.point),
33 request(f.request),
34 reply(f.reply),
35 al(f.al)
36 {
37 if (request)
38 HTTPMSGLOCK(request);
39
40 if (reply)
41 HTTPMSGLOCK(reply);
42 }
43
44 Adaptation::ServiceFilter::~ServiceFilter()
45 {
46 HTTPMSGUNLOCK(request);
47 HTTPMSGUNLOCK(reply);
48 }
49
50 Adaptation::ServiceFilter &Adaptation::ServiceFilter::operator =(const ServiceFilter &f)
51 {
52 if (this != &f) {
53 method = f.method;
54 point = f.point;
55 HTTPMSGUNLOCK(request);
56 HTTPMSGUNLOCK(reply);
57 request = f.request;
58 HTTPMSGLOCK(request);
59 reply = f.reply;
60 if (reply)
61 HTTPMSGLOCK(reply);
62 }
63 return *this;
64 }
65