]>
Commit | Line | Data |
---|---|---|
b67e2c8c | 1 | /* |
4ac4a490 | 2 | * Copyright (C) 1996-2017 The Squid Software Foundation and contributors |
b67e2c8c | 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. | |
b67e2c8c | 7 | */ |
8 | ||
bbc27441 AJ |
9 | /* DEBUG: section 77 Delay Pools */ |
10 | ||
f7f3304a | 11 | #include "squid.h" |
b67e2c8c | 12 | |
9a0a18de | 13 | #if USE_DELAY_POOLS |
3ad63615 AR |
14 | #include "acl/Acl.h" |
15 | #include "acl/Gadgets.h" | |
602d9612 A |
16 | #include "CommonPool.h" |
17 | #include "DelayPool.h" | |
b67e2c8c | 18 | #include "Store.h" |
19 | ||
20 | DelayPool::DelayPool() : pool (NULL), access (NULL) | |
21 | { | |
22 | pool = CommonPool::Factory(0, theComposite_); | |
23 | } | |
24 | ||
25 | DelayPool::~DelayPool() | |
26 | { | |
b67e2c8c | 27 | if (pool) |
62e76326 | 28 | freeData(); |
29 | ||
b67e2c8c | 30 | if (access) |
62e76326 | 31 | aclDestroyAccessList(&access); |
b67e2c8c | 32 | } |
33 | ||
34 | void | |
35 | DelayPool::parse() | |
36 | { | |
63be0a78 | 37 | assert(theComposite() != NULL); |
b67e2c8c | 38 | theComposite()->parse(); |
39 | } | |
40 | ||
41 | void | |
63be0a78 | 42 | DelayPool::dump(StoreEntry *entry, unsigned int i) const |
b67e2c8c | 43 | { |
110f57f4 | 44 | if (theComposite() == NULL) |
62e76326 | 45 | return; |
46 | ||
47 | storeAppendPrintf(entry, "delay_class %d %s\n", i + 1, pool->theClassTypeLabel()); | |
48 | ||
49 | LOCAL_ARRAY(char, nom, 32); | |
50 | ||
51 | snprintf(nom, 32, "delay_access %d", i + 1); | |
52 | ||
53 | dump_acl_access(entry, nom, access); | |
54 | ||
55 | storeAppendPrintf(entry, "delay_parameters %d", i + 1); | |
56 | ||
57 | theComposite()->dump (entry); | |
58 | ||
59 | storeAppendPrintf(entry, "\n"); | |
b67e2c8c | 60 | } |
61 | ||
62 | void | |
63 | DelayPool::createPool(u_char delay_class) | |
64 | { | |
65 | if (pool) | |
62e76326 | 66 | freeData(); |
67 | ||
b67e2c8c | 68 | pool = CommonPool::Factory(delay_class, theComposite_); |
69 | } | |
70 | ||
71 | void | |
72 | DelayPool::freeData() | |
73 | { | |
00d77d6b | 74 | delete pool; |
b67e2c8c | 75 | pool = NULL; |
76 | } | |
77 | ||
63be0a78 | 78 | /** \todo XXX create DelayIdComposite.cc */ |
a46d2c0e | 79 | void |
80 | CompositePoolNode::delayRead(DeferredRead const &aRead) | |
81 | { | |
82 | deferredReads.delayRead(aRead); | |
83 | } | |
84 | ||
85 | #include "comm.h" | |
b67e2c8c | 86 | |
a46d2c0e | 87 | void |
88 | CompositePoolNode::kickReads() | |
89 | { | |
27b24462 | 90 | deferredReads.kickReads(-1); |
a46d2c0e | 91 | } |
92 | ||
9a0a18de | 93 | #endif /* USE_DELAY_POOLS */ |
f53969cc | 94 |