]> git.ipfire.org Git - thirdparty/squid.git/blame - src/Pipeline.cc
Source Format Enforcement (#963)
[thirdparty/squid.git] / src / Pipeline.cc
CommitLineData
8e64903f 1/*
bf95c10a 2 * Copyright (C) 1996-2022 The Squid Software Foundation and contributors
8e64903f
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
9/*
10 * DEBUG: section 33 Client Request Pipeline
11 */
12#include "squid.h"
22d80540 13#include "anyp/PortCfg.h"
8e64903f
AJ
14#include "client_side.h"
15#include "Debug.h"
d3dddfb5 16#include "http/Stream.h"
8e64903f
AJ
17#include "Pipeline.h"
18
19void
d3dddfb5 20Pipeline::add(const Http::StreamPointer &c)
8e64903f
AJ
21{
22 requests.push_back(c);
23 ++nrequests;
24 debugs(33, 3, "Pipeline " << (void*)this << " add request " << nrequests << ' ' << c);
25}
26
d3dddfb5 27Http::StreamPointer
8e64903f
AJ
28Pipeline::front() const
29{
30 if (requests.empty()) {
31 debugs(33, 3, "Pipeline " << (void*)this << " empty");
d3dddfb5 32 return Http::StreamPointer();
8e64903f
AJ
33 }
34
35 debugs(33, 3, "Pipeline " << (void*)this << " front " << requests.front());
36 return requests.front();
37}
38
da6dbcd1
EB
39Http::StreamPointer
40Pipeline::back() const
41{
42 if (requests.empty()) {
43 debugs(33, 3, "Pipeline " << (void*)this << " empty");
44 return Http::StreamPointer();
45 }
46
47 debugs(33, 3, "Pipeline " << (void*)this << " back " << requests.back());
48 return requests.back();
49}
50
8e64903f 51void
d3dddfb5 52Pipeline::popMe(const Http::StreamPointer &which)
8e64903f
AJ
53{
54 if (requests.empty())
55 return;
56
2c391676
AJ
57 debugs(33, 3, "Pipeline " << (void*)this << " drop " << requests.front());
58 // in reality there may be multiple contexts doing processing in parallel.
59 // XXX: pipeline still assumes HTTP/1 FIFO semantics are obeyed.
60 assert(which == requests.front());
61 requests.pop_front();
8e64903f
AJ
62}
63