]> git.ipfire.org Git - thirdparty/squid.git/blame - src/adaptation/ServiceFilter.cc
SourceFormat Enforcement
[thirdparty/squid.git] / src / adaptation / ServiceFilter.cc
CommitLineData
bbc27441 1/*
bde978a6 2 * Copyright (C) 1996-2015 The Squid Software Foundation and contributors
bbc27441
AJ
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
582c2af2 9#include "squid.h"
af0ded40 10#include "AccessLogEntry.h"
a22e6cd3 11#include "adaptation/ServiceFilter.h"
602d9612
A
12#include "HttpReply.h"
13#include "HttpRequest.h"
a22e6cd3 14
af0ded40 15Adaptation::ServiceFilter::ServiceFilter(Method aMethod, VectPoint aPoint, HttpRequest *aReq, HttpReply *aRep, AccessLogEntry::Pointer const &alp):
f53969cc
SM
16 method(aMethod),
17 point(aPoint),
18 request(aReq),
19 reply(aRep),
20 al(alp)
a22e6cd3 21{
b248c2a3
AJ
22 if (reply)
23 HTTPMSGLOCK(reply);
24
a22e6cd3
AR
25 // a lot of code assumes that there is always a virgin request or cause
26 assert(request);
b248c2a3 27 HTTPMSGLOCK(request);
a22e6cd3
AR
28}
29
30Adaptation::ServiceFilter::ServiceFilter(const ServiceFilter &f):
f53969cc
SM
31 method(f.method),
32 point(f.point),
33 request(f.request),
34 reply(f.reply),
35 al(f.al)
a22e6cd3 36{
b248c2a3
AJ
37 if (request)
38 HTTPMSGLOCK(request);
39
40 if (reply)
41 HTTPMSGLOCK(reply);
a22e6cd3
AR
42}
43
44Adaptation::ServiceFilter::~ServiceFilter()
45{
46 HTTPMSGUNLOCK(request);
47 HTTPMSGUNLOCK(reply);
48}
49
50Adaptation::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);
b248c2a3
AJ
57 request = f.request;
58 HTTPMSGLOCK(request);
59 reply = f.reply;
60 if (reply)
61 HTTPMSGLOCK(reply);
a22e6cd3
AR
62 }
63 return *this;
64}
f53969cc 65