]>
Commit | Line | Data |
---|---|---|
6039b729 | 1 | /* |
bf95c10a | 2 | * Copyright (C) 1996-2022 The Squid Software Foundation and contributors |
6039b729 | 3 | * |
bbc27441 AJ |
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. | |
6039b729 | 7 | */ |
bbc27441 AJ |
8 | |
9 | /* DEBUG: section 05 Comm */ | |
10 | ||
6039b729 | 11 | #ifndef COMMREAD_H |
12 | #define COMMREAD_H | |
13 | ||
b0c2361b | 14 | #include "base/CbDataList.h" |
a553a5a3 | 15 | #include "comm.h" |
3e4bebf8 | 16 | #include "comm/forward.h" |
602d9612 | 17 | #include "CommCalls.h" |
6039b729 | 18 | |
19 | class CommRead | |
20 | { | |
21 | ||
22 | public: | |
3e4bebf8 AJ |
23 | CommRead(); |
24 | CommRead(const Comm::ConnectionPointer &c, char *buf, int len, AsyncCall::Pointer &callback); | |
25 | Comm::ConnectionPointer conn; | |
6039b729 | 26 | char *buf; |
27 | int len; | |
d1fab16b | 28 | AsyncCall::Pointer callback; |
6039b729 | 29 | }; |
30 | ||
31 | class DeferredRead | |
32 | { | |
33 | ||
34 | public: | |
35 | typedef void DeferrableRead(void *context, CommRead const &); | |
6039b729 | 36 | DeferredRead (); |
37 | DeferredRead (DeferrableRead *, void *, CommRead const &); | |
38 | void markCancelled(); | |
39 | DeferrableRead *theReader; | |
40 | void *theContext; | |
41 | CommRead theRead; | |
42 | bool cancelled; | |
2796c0d7 | 43 | AsyncCall::Pointer closer; ///< internal close handler used by Comm |
6039b729 | 44 | |
45 | private: | |
6039b729 | 46 | }; |
47 | ||
48 | class DeferredReadManager | |
49 | { | |
50 | ||
51 | public: | |
52 | ~DeferredReadManager(); | |
53 | void delayRead(DeferredRead const &); | |
54 | void kickReads(int const count); | |
55 | ||
56 | private: | |
575d05c4 | 57 | static CLCB CloseHandler; |
2236466c | 58 | static DeferredRead popHead(CbDataListContainer<DeferredRead> &deferredReads); |
6039b729 | 59 | void kickARead(DeferredRead const &); |
60 | void flushReads(); | |
2236466c | 61 | CbDataListContainer<DeferredRead> deferredReads; |
6039b729 | 62 | }; |
63 | ||
6039b729 | 64 | #endif /* COMMREAD_H */ |
f53969cc | 65 |