]> git.ipfire.org Git - thirdparty/squid.git/blob - src/Pipeline.cc
Rename ClientSocketContext::connIsFinished() to finished()
[thirdparty/squid.git] / src / Pipeline.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 /*
10 * DEBUG: section 33 Client Request Pipeline
11 */
12 #include "squid.h"
13 #include "client_side.h"
14 #include "Debug.h"
15 #include "Pipeline.h"
16
17 void
18 Pipeline::add(const ClientSocketContextPointer &c)
19 {
20 requests.push_back(c);
21 ++nrequests;
22 debugs(33, 3, "Pipeline " << (void*)this << " add request " << nrequests << ' ' << c);
23 }
24
25 ClientSocketContextPointer
26 Pipeline::front() const
27 {
28 if (requests.empty()) {
29 debugs(33, 3, "Pipeline " << (void*)this << " empty");
30 return ClientSocketContextPointer();
31 }
32
33 debugs(33, 3, "Pipeline " << (void*)this << " front " << requests.front());
34 return requests.front();
35 }
36
37 void
38 Pipeline::terminateAll(int xerrno)
39 {
40 while (!requests.empty()) {
41 ClientSocketContextPointer context = requests.front();
42 debugs(33, 3, "Pipeline " << (void*)this << " notify(" << xerrno << ") " << context);
43 context->noteIoError(xerrno);
44 context->finished(); // cleanup and self-deregister
45 assert(context != requests.front());
46 }
47 }
48
49 void
50 Pipeline::pop()
51 {
52 if (requests.empty())
53 return;
54
55 debugs(33, 3, "Pipeline " << (void*)this << " drop " << requests.front());
56 requests.pop_front();
57 }
58