]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/Pipeline.h
2 * Copyright (C) 1996-2017 The Squid Software Foundation and contributors
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.
9 #ifndef SQUID_SRC_PIPELINE_H
10 #define SQUID_SRC_PIPELINE_H
12 #include "base/RefCount.h"
13 #include "http/forward.h"
18 * A queue of transactions awaiting completion.
20 * Transactions in the queue may be fully processed, but not yet delivered,
21 * or only partially processed.
23 * - HTTP/1 pipelined requests can be processed out of order but
24 * responses MUST be written to the client in-order.
25 * The front() context is for the response writing transaction.
26 * The back context may still be reading a request payload/body.
27 * Other contexts are in deferred I/O state, but may be accumulating
28 * payload/body data to be written later.
30 * - HTTP/2 multiplexed streams can be processed and delivered in any order.
32 * For consistency we treat the pipeline as a FIFO queue in both cases.
36 Pipeline(const Pipeline
&) = delete;
37 Pipeline
& operator =(const Pipeline
&) = delete;
40 Pipeline() : nrequests(0) {}
41 ~Pipeline() = default;
43 /// register a new request context to the pipeline
44 void add(const Http::StreamPointer
&);
46 /// get the first request context in the pipeline
47 Http::StreamPointer
front() const;
49 /// get the last request context in the pipeline
50 Http::StreamPointer
back() const;
52 /// how many requests are currently pipelined
53 size_t count() const {return requests
.size();}
55 /// whether there are none or any requests currently pipelined
56 bool empty() const {return requests
.empty();}
58 /// tell everybody about the err, and abort all waiting requests
59 void terminateAll(const int xerrno
);
61 /// deregister the front request from the pipeline
62 void popMe(const Http::StreamPointer
&);
64 /// Number of requests seen in this pipeline (so far).
65 /// Includes incomplete transactions.
69 /// requests parsed from the connection but not yet completed.
70 std::list
<Http::StreamPointer
> requests
;
73 #endif /* SQUID_SRC_PIPELINE_H */